我的导航抽屉有问题。
我无法在导航抽屉内滚动......但我的列表视图中有足够的项目。
我检查了我的 xml,但没有找到导致问题的任何原因。
这是我定义 ListView 的“主要”XML:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com /apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Hauptmenue_extended" >
<ListView
android:id="@+id/left_drawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:background="#fff" />
</android.support.v4.widget.DrawerLayout>
这是我的代码:
mDrawerLayout = (DrawerLayout) findViewById(R.id.fragView);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
GravityCompat.START);
// Get the titles ...
drawerTitles = getResources().getStringArray(
R.array.drawerTitles_array);
// Get the sub titles ...
drawerSubtitles = getResources().getStringArray(
R.array.drawerSubtitles_array);
// Set the icons ...
drawerIcons = new int[] { R.drawable.icon_buergermeldung,
R.drawable.icon_sprechblase,
R.drawable.icon_action_settings_dark, R.drawable.icon_user_chat, R.drawable.icon_haus, R.drawable.icon_contact, R.drawable.icon_calendar, R.drawable.icon_search, R.drawable.icon_zaehlerstand };
// Create new MenuListAdapter
MenuListAdapter mMenuAdapter = new MenuListAdapter(this,
drawerTitles, drawerSubtitles, drawerIcons);
mDrawerList.setAdapter(mMenuAdapter);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
// Add Navigation Drawer to Action Bar
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, R.string.drawer_open,
R.string.drawer_close) {
public void onDrawerClosed(View view) {
getSupportActionBar().setTitle(mTitle);
supportInvalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
getSupportActionBar().setTitle(R.string.app_name);
supportInvalidateOptionsMenu();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
谁能帮我?