我有导航抽屉XML布局如下,列表视图点击不工作的抽屉式导航
<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">
<ListView
android:id="@+id/left_drawer"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/black"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:descendantFocusability="afterDescendants"
android:focusable="false"
android:focusableInTouchMode="true" />
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.DrawerLayout>
进出口设置onItemClickLister如下,
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(),"sd",Toast.LENGTH_SHORT).show();
}
});
但导航抽屉的onItemClickListener仍未被解雇。
还是一样的问题仍然存在 –
IM下面这个例子https://trinitytuts.com/navigation-drawer-with-tabview-in-android/ –
机器人:descendantFocusability =“blocksDescendants您drawer_item.xml – saeed