mobidevelop / android-split-pane-layout Goto Github PK
View Code? Open in Web Editor NEWAn Android layout which splits the available space between child views
License: Apache License 2.0
An Android layout which splits the available space between child views
License: Apache License 2.0
If you create a SplitPaneLayout programmatically and adds it to your activity, it does not have default splitter drawables, colors, etc. It does have when including it by XML.
When I move split position to up or down, child splits below also change, but child splits above is not affect ( when I move it to left or right, I got the same issue). How I can move split position but child splits is not affect?
Thanks
Thanks for the library. Whenever I have the component above another view, e,g, a button, and I set visibility of the button to GONE, one of the areas takes the whole new space and assigned percentage is lost. It would be necessary a recalculation based in the assigned percentage.
I tried by doing requestLayout() on different places but no luck. Any idea how to do that?
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.mobidevelop.spl.widget.SplitPaneLayout
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.mobidevelop.spl.widget.SplitPaneLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.ashomok.imagetotext.ocr_result.tab_fragments.TextFragment.onCreateView(TextFragment.java:63)
at android.app.Fragment.performCreateView(Fragment.java:2611)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1276)
at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2415)
at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2194)
at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2148)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2049)
at android.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:798)
at android.support.v13.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:151)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1236)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
at android.view.View.measure(View.java:22002)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:91)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1361)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:784)
at android.view.View.measure(View.java:22002)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
at android.view.View.measure(View.java:22002)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:22002)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:22002)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:22002)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:721)
at android.view.View.measure(View.java:22002)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2410)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1498)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to dimension: type=0x1d
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
at com.mobidevelop.spl.widget.SplitPaneLayout.extractAttributes(SplitPaneLayout.java:86)
at com.mobidevelop.spl.widget.SplitPaneLayout.<init>(SplitPaneLayout.java:74)
... 63 more
Test running failed: Instrumentation run failed due to 'Process crashed.'
text_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<com.mobidevelop.spl.widget.SplitPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:spl="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
spl:orientation="vertical"
spl:splitterBackground="@color/colorAccent"
spl:splitterPosition="33%"
spl:splitterSize="12dip"
android:id="@+id/split_pane_layout">
<include layout="@layout/split_pane_content" />
</com.mobidevelop.spl.widget.SplitPaneLayout>
Any advices?
Hi ,
Thanks for library. I am using tableview and mapview as child inside split pane layout .
I want to implement horizontal scrollview for tableview .If i add horizontal scrollview as parent to table view following error occuring in split pane layout. I have tried put a layout for horizontal scrollview with table view as one child and map view as another child,but same error is coming.
Sample code
<com.mobidevelop.spl.widget.SplitPaneLayout
android:id="@+id/layout_map_track"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/appBar_reprt_map"
android:visibility="visible">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_below="@+id/toolbar"
android:layout_height="wrap_content">
<de.codecrafters.tableview.SortableTableView
android:id="@+id/tableView_map"
android:layout_width="800dp"
android:layout_height="match_parent"
android:scrollbars="horizontal"
/>
</HorizontalScrollView>
<fragment
android:id="@+id/map"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.mobidevelop.spl.widget.SplitPaneLayout>
Error
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams
at android.widget.FrameLayout.onMeasure(FrameLayout.java:224)
at android.widget.HorizontalScrollView.onMeasure(HorizontalScrollView.java:315)
at android.view.View.measure(View.java:19169)
at com.mobidevelop.spl.widget.SplitPaneLayout.onMeasure(SplitPaneLayout.java:160)
at android.view.View.measure(View.java:19169)
Hi, there.
Experimenting a bit with this layout, using it as the parent element of a fragment crashes the app in runtime... With no error message at all in the debugging window in Android Studio. The error occurs in the onCreateView fragment event, when the "inflate" method is invoked.
I'm using kotlin, Android Studio 3.3, androidx, gradle 3.3... Also, on kotlin, a SplitPaneLayout object... There's some kind of issue with "onSplitterPositionChangedListener"... Can't be resolved...
Any idea?
Right now you can get the splitter into an odd state where it is not visible on screen. It would be nice to have some attributes setting a minimum and maximum split % just like you have for the initial split % stopping the user from getting into this situation and allowing more control over the splitter.
Right now, the only way to set the orientation is via the XML attribute, which limits SplitPaneLayout
's use when dynamically constructed. Adding a getter/setter pair for orientation would parallel the other options that can be set via attributes or setters.
Thanks!
Having some views above and below the splitPaneLayout, i.e. a toolbar and a navigationBottomBar, then SplitPaneLayout doesn't calculate correctly the position of the splitter the first time it is loaded.
Error:(16, 0) Could not find method runProguard() for arguments [false] on BuildType_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.
Just make a change to your SplitPaneLayout, such as positionPercent or orientation and try to change device orientation. It won't be restored with their last values but with default/XML attributes.
If you create a SplitPaneLayout programmatically and adds it to your activity, children aren't focusable/navegable, although it works when adding it in XML.
Environment: Nexus 10, Android 4.2.2
Steps to Reproduce: Install app from barcode, then run
Expected Results: a really cool split-pane layout demo :-)
Actual Results: crash, with the following stack trace
04-11 18:26:31.962: E/AndroidRuntime(5048): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mobidevelop.widget/com.mobidevelop.widget.Demo}: java.lang.ClassNotFoundException: Didn't find class "com.mobidevelop.widget.Demo" on path: /data/app/com.mobidevelop.widget-1.apk
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.os.Looper.loop(Looper.java:137)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-11 18:26:31.962: E/AndroidRuntime(5048): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 18:26:31.962: E/AndroidRuntime(5048): at java.lang.reflect.Method.invoke(Method.java:511)
04-11 18:26:31.962: E/AndroidRuntime(5048): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-11 18:26:31.962: E/AndroidRuntime(5048): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-11 18:26:31.962: E/AndroidRuntime(5048): at dalvik.system.NativeStart.main(Native Method)
04-11 18:26:31.962: E/AndroidRuntime(5048): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mobidevelop.widget.Demo" on path: /data/app/com.mobidevelop.widget-1.apk
04-11 18:26:31.962: E/AndroidRuntime(5048): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
04-11 18:26:31.962: E/AndroidRuntime(5048): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-11 18:26:31.962: E/AndroidRuntime(5048): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
04-11 18:26:31.962: E/AndroidRuntime(5048): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-11 18:26:31.962: E/AndroidRuntime(5048): ... 11 more
If the children of SplitPaneLayout are clickables, for example when using a ScrollView, then splitterTouchSlop doesn't work properly, as the touch event is handled by the ScrollView and not by the splitter.
I am calling setSplitterSize() and setSplitterPositionPercent() in our app to show and hide a Google Street View. Unfortunately both of those methods force the remeasure() method to be called which seems to cause performance issues. Here is how I hide the street view and the splitter:
splitPaneLayout.setSplitterSize( 0 );
splitPaneLayout.setSplitterPositionPercent( 0.0001f );
Here is the code I use to later show the street view and splitter:
splitPaneLayout.setSplitterSize( 20 );
splitPaneLayout.setSplitterPositionPercent( 0.5f );
The street view is initially hidden:
I did not see a way to subclass SplitPaneLayout to avoid remeasure being called twice.
I tried the APK demo, it didn't displ. anything & crashed,
then I tried to use the SplitLayoutPanel but NOT by the layout.xml way, in the Activity code...
( new SplitLayoutPanel(Context...).addView(...) )
The Panel took always more than the screen, and the splitDivider was not visible,
So I modified it :
If you are intrested with the modif. code, let me know....
I got errors on build:
error: cannot find symbol variable SplitPaneLayout_splitterTouchSlop
error: cannot find symbol variable SplitPaneLayout_paneSizeMin
https://prnt.sc/ptbc6e
In the demo project, you have your <shape>
files in res/drawable-hdpi/
. Since <shape>
drawables have no density, they are usually put in res/drawable/
-- you'll see this in the SDK resources, for example. I just tried your shapes in res/drawable/
in the project I am working on, and they seem to work fine there. Is there a reason you put them in res/drawable-hdpi/
?
The published version of SplitPaneLayout on Maven Central doesn't match with latest stable commits (I don't mean with my latest pull request). It would be great if it is updated.
When user moves the splitter to 0% or 100% or very close to it, the splitter drawable is partially hidden at the border. I expect to see it completely not half of it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.