您好我有以下布局文件:
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
问题:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Add The mainmenu-->
// add a linearLayout with 3 row of imagaeView
<!-- The navigation drawer -->
<Mvx.MvxListView
local:MvxBind="ItemsSource MenuItems; ItemClick SelectMenuItemCommand"
local:MvxItemTemplate="@layout/item_menu"
android:id="@+id/left_drawer"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:choiceMode="singleChoice"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111" />
</android.support.v4.widget.DrawerLayout>
位于左侧。
问题:
NavigationDrawer
吗?FrameLayout
替换为FrameLayout
吗?答案 0 :(得分:0)
DrawerLayout
仅支持两个子视图。
第一个元素必须始终是内容视图,第二个元素必须是抽屉中的内容,并且您必须指定一个重力来指示抽屉是从左侧还是右侧进入。
如果您想在抽屉中放置多个ListView
,只需将内容包装在另一个布局中,例如RelativeLayout
,FrameLayout
或LinearLayout
:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<LinearLayout
android:orientation="vertical"
android:layout_width="240dp"
android:layout_gravity="start"
android:layout_height="match_parent">
<!-- add other views here -->
<Mvx.MvxListView
local:MvxBind="ItemsSource MenuItems; ItemClick SelectMenuItemCommand"
local:MvxItemTemplate="@layout/item_menu"
android:id="@+id/left_drawer"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:choiceMode="singleChoice"
android:layout_width="match_parent"
android:layout_height="0"
android:layout_weight="1"
android:background="#111" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>