Android 我可以设置listView';抽屉布局中的重力到底是多少?
我想这样做Android 我可以设置listView';抽屉布局中的重力到底是多少?,android,navigation-drawer,slidingmenu,drawerlayout,Android,Navigation Drawer,Slidingmenu,Drawerlayout,我想这样做 <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"> <!-- As the main content view
<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">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
The drawer is given a fixed width in dp and extends the full height of
the container. A solid background is used for contrast
with the content view. -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="@android:color/transparent"/>
</android.support.v4.widget.DrawerLayout>
它给出了错误
致命异常-抽屉不是滑动抽屉
可以将重力设置为底部吗
以及如何使用片段而不是listview。我想通过按按钮在片段之间切换
我们可以移除操作栏并使用按钮填充抽屉吗
我想用按钮在菜单之间切换
多亏了所有…你们想让抽屉从屏幕底部出来吗?因为滑动抽屉并没有像我想的那个样为我工作!
new ActionBarDrawerToggle(
this, /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
R.string.drawer_open, /* "open drawer" description for accessibility */
R.string.drawer_close /* "close drawer" description for accessibility */
) {
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item != null && item.getItemId() == android.R.id.home) {
if (mDrawerLayout.isDrawerOpen(Gravity.BOTTOM)) {
mDrawerLayout.closeDrawer(Gravity.BOTTOM);
} else {
mDrawerLayout.openDrawer(Gravity.BOTTOM);
}
}
return false;
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
if (savedInstanceState == null) {
selectItem(0);
}
}