0
A
回答
0
我不确定这是否是您正在寻找的确切答案,但我使用AppCompat(ActionBarActivity)库构建了一个导航抽屉。我还添加了诸如spinners(下拉列表)之类的东西到导航抽屉XML中,用于不同的屏幕。
注意:在这个例子中,我实际上是以编程方式将条目添加到XML中,但XML是抽屉的框架。我基本上做了一个垂直的线性布局,滚动链接列表编号为externalLinks
。
声明:纯化材料设计人员会注意到,我的导航抽屉在动作栏下方,但我喜欢提供并且不想掩盖的小汉堡包 - >箭头图标。区别在于actionBarSize的layout_MarginTop。
希望这会有所帮助!
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawerLayout"
android:background="@color/background"
>
<!-- The main content view -->
<LinearLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="@layout/common_toolbar"/>
<ScrollView
android:id="@+id/login_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- There is a bunch of layout that I removed because it is just my app's screen and isn't part of the answer -->
</LinearLayout>
</ScrollView>
</LinearLayout>
<!-- The navigation drawer -->
<LinearLayout
android:layout_marginTop="?attr/actionBarSize"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="1dp"
android:background="@color/background"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@color/colorAccent"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/navMoreTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/navExternal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingStart="5dp"
android:paddingRight="5dp"
android:paddingEnd="5dp"
android:minHeight="30dp"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@color/white"
/>
<LinearLayout
android:id="@+id/externalLinks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/background"
>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
相关问题
- 1. 自定义抽屉导航布局(xml)
- 2. 如何在自定义导航抽屉上设置布局
- 3. 自定义抽屉布局
- 4. Android导航抽屉:如何根据抽屉列表项选择
- 5. 安卓:如何创建一个导航抽屉自定义布局
- 6. 自定义导航抽屉ArrayIndefOutOfBounds
- 7. 自定义动画导航抽屉
- 8. 自定义导航抽屉及项目
- 9. 如何将碎片布局与导航抽屉布局结合
- 10. 导航抽屉破坏布局
- 11. 使用导航抽屉更改布局
- 12. 自定义适配器导航抽屉选定项目textColor
- 13. Android - 错误当我试图在导航抽屉上应用自定义布局
- 14. 如何在打开时自定义导航抽屉的动画
- 15. Android导航抽屉选择器颜色
- 16. 无法选择导航抽屉图标
- 17. 导航抽屉布局与包括布局
- 18. 在导航抽屉布局中显示网格布局?
- 19. 如何自定义导航抽屉项目高度
- 20. 如何在导航抽屉中进行自定义设计?
- 21. 如何在导航抽屉中添加自定义ListView?谢谢
- 22. 如何创建Android自定义条纹导航抽屉?
- 23. 如何添加自定义动作栏导航抽屉?
- 24. 如何解析Android中的XML文件(使用导航抽屉作为布局)
- 25. 导航抽屉
- 26. 如何添加布局到导航抽屉?
- 27. 导航抽屉定制
- 28. 如何定制谷歌导航抽屉?
- 29. 具有特定设计的Android自定义导航抽屉
- 30. 具有两个导航视图和选定项目颜色的抽屉布局