I have a bug in my application and I dont know how to solve it. My application has two navigation drawer, right and left. The right navigation drawer works well but when the left navigation drawer is open and I click within it, it detect that I'm clicking in the main layout. In order to understand better I show you this picture:
I hope I explained well.
This is my code:
layout.
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0" />
<!-- Left -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="400dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/black_main"
android:choiceMode="singleChoice"
android:divider="#555555"
android:dividerHeight="1dp"
android:listSelector="@drawable/menu_list_selector" />
<!-- Right -->
<LinearLayout
android:id="@+id/right_drawer"
android:layout_width="400dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:choiceMode="singleChoice"
android:background="@color/white_opaque"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/container_filtros"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/cnt_filtros"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include
android:id="@+id/filtros"
layout="@layout/menu_filtros" />
</LinearLayout>
<LinearLayout
android:id="@+id/cnt_categorias"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone" >
<include
android:id="@+id/lstCategorias"
layout="@layout/filter_categorias" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
Java code:
private void setSlides(Bundle savedInstanceState) {
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerViewRight = (View) findViewById(R.id.right_drawer);
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
mDrawerList = (ListView) findViewById(R.id.list_slidermenu);
mFilterList = (ListView) findViewById(R.id.list_filter);
mRightDrawerList = (ListView) findViewById(R.id.right_drawer_list);
mOrdenarList = (ListView) findViewById(R.id.list_ordenar);
mDistanceList = (ListView) findViewById(R.id.list_distance);
// LEFT SLIDING
navDrawerItems = new ArrayList<MoNavMenu>();
// Items
navDrawerItems.add(new MoNavMenu("DIIN", R.drawable.slide_img_home));
navDrawerItems.add(new MoNavMenu("¿QUÉ HACER", R.drawable.slide_img_quehacer));
navDrawerItems.add(new MoNavMenu("¿A DÓNDE IR?", R.drawable.slide_img_dondeir));
navDrawerItems.add(new MoNavMenu("DESCUBRE", R.drawable.slide_img_descubre));
navDrawerItems.add(new MoNavMenu("LEE TU MAPA", R.drawable.slide_img_leermapa));
navDrawerItems.add(new MoNavMenu("CAPTURA DIIN", R.drawable.slide_img_captura));
navDrawerItems.add(new MoNavMenu());
navDrawerItems.add(new MoNavMenu("CONFIGURACIÓN", R.drawable.slide_img_config));
// RIGHT SLIDING
navRightDrawerItems = new ArrayList<MoNavCategory>();
navFilters = new ArrayList<MoNavFilter>();
navFilters.add(new MoNavFilter("CATEGORÍA", filterCategoria));
adapter = new AdNavMenu(getApplicationContext(), navDrawerItems);
adapterR = new AdNavRight(this, navRightDrawerItems);
adapterFilter = new AdFilterHome(this, navFilters);
mDrawerList.setAdapter(adapter);
mFilterList.setAdapter(adapterFilter);
mRightDrawerList.setAdapter(adapterR);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer,
R.string.app_name,
R.string.app_name
) {
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
if (savedInstanceState == null) {
displayView(0);
}
}
You have to write android:clickable="true"
in your sliding pane layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With