我正在尝试使用SlidingPaneLayout。左视图是一个ListFragment视图,右边视图是一个详细视图。布局显示正确,我可以滑动它。但是,如果细节视图在列表前面,而我单击它,则背景中的列表将收到单击。
我的布局如下:
<?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);
}我怎么才能解决这个问题?
发布于 2013-12-19 08:52:33
只需将android:clickable="true"添加到SlidingPaneLayout中的第二个Fragment或FrameLayout即可。
发布于 2014-07-17 06:49:53
洛克图斯是对的。无论顶部的片段是什么,添加属性
android:clickable="true"因此,它不会将click事件传递给下面的片段。
谢谢大家帮我节省时间。这是我的密码。我使用了覆盖的布局,但这也适用于常规的滑动窗格布局。看第二个片段,我添加了可点击的真实属性。
<com.ironone.streaming.application.MySlidingPaneLayout
android:id="@+id/pane"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/pane1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/pane2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true" />
</com.ironone.streaming.application.MySlidingPaneLayout>发布于 2013-10-11 15:12:43
我有同样的问题,我认为这是一个"v4“版本的片段和ListFragment和SlidingPanelLayout.如果您将导入从"v4“更改为导入正常的"android.app.ListFragment;”和“导入android.app.Fragment”,则一切正常。
对不起我的英语;)
https://stackoverflow.com/questions/18181749
复制相似问题