I'm trying to use the SlidingPaneLayout. The left view is a ListFragment and the right view is a detail view. The layout is displayed correctly and I can slide it. But if the detail view is in front of the list and I click on it, the list in the background receives the click.
My layout looks like this:
<?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>
I use this code for setting up the click listener in the ListFragment
@Override
public void onListItemClick(ListView list, View view, int position, long id) {
iItemClickListener.onListFragmentItemClick(view, position);
}
How can I solve this?
Locutus was correct. Whatever the fragment on top, add the property
so it will not pass the click event to the fragment below.
Thanks everyone for saving my time. Here is my code. I have used an overridden layout but this works on regular sliding pane layout as well. look at the 2nd fragment, I've added clickable true property.
Just add
android:clickable="true"
to the secondFragment
orFrameLayout
in theSlidingPaneLayout
.I have the same problem, I think it's a combination of "v4" version of Fragment and ListFragment and the SlidingPanelLayout... If you change the import from "v4" to import normal "android.app.ListFragment;" and "import android.app.Fragment;" everything works.
Sorry for my english ;)