我正在尝试使用 SlidingPaneLayout。左 View 是 ListFragment,右 View 是详细 View 。布局显示正确,我可以滑动它。但是如果详细 View 在列表前面并且我点击它,后台的列表会收到点击。
我的布局是这样的:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sliding_pane_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment android:name="net.name.multiremote.RemoteListFragement"
android:id="@+id/fragment_remote_list"
android:layout_width="580dp"
android:layout_height="match_parent"
android:layout_gravity="left" />
<fragment
android:id="@+id/fragment_remote"
android:name="net.name.multiremote.RemoteFragment"
android:layout_width="850dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</android.support.v4.widget.SlidingPaneLayout>
我使用这段代码在 ListFragment 中设置点击监听器
@Override
public void onListItemClick(ListView list, View view, int position, long id) {
iItemClickListener.onListFragmentItemClick(view, position);
}
我该如何解决这个问题?
最佳答案
只需将 android:clickable="true"
添加到 SlidingPaneLayout
中的第二个 Fragment
或 FrameLayout
即可。
关于android - SlidingPaneLayout 上的点击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18181749/