我添加了
implementation 'com.mobidevelop.spl:split-pane-layout:1.0.0'
到我的依赖项,并像下面的代码片段一样使用它。但是当我尝试拖动甚至点击分隔线时,它就会崩溃。在Android上似乎我们受此可调整大小的窗格的困扰-如何使SplitPaneLayout工作?
<?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="match_parent"
android:layout_height="match_parent"
spl:orientation="vertical"
spl:splitterMovable="true"
spl:splitterPosition="40%"
spl:splitterSize="50dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:showDividers="middle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/urledittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="URL"
android:inputType="text"
android:maxLines="1"
android:selectAllOnFocus="true"
android:textColor="#000000" />
<ImageButton
android:id="@+id/pastebutton"
android:layout_width="@android:dimen/app_icon_size"
android:layout_height="match_parent"
android:layout_weight="0"
android:src="@drawable/ic_menu_paste" />
<ImageButton
android:id="@+id/linkDeactivator"
android:layout_width="@android:dimen/app_icon_size"
android:layout_height="match_parent"
android:layout_weight="0"
android:src="@drawable/ic_menu_stop" />
</LinearLayout>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5" />
</LinearLayout>
<TextView
android:id="@+id/japaneseview"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:background="#fff"
android:scrollbars="vertical"
android:textColor="#000000" />
</com.mobidevelop.spl.widget.SplitPaneLayout>
当我添加spl:splitterBackground="#ff0000"
属性时,它将在启动时立即崩溃。