【发布时间】:2013-08-13 06:00:59
【问题描述】:
我很难找到有关如何正确设计标准Navigation Drawer 的任何资源。我有以下 XML,并且正在寻找填充多个列表视图、更改列表视图中文本字体等的方法。
我正在尝试设计类似于以下一些设计。
除了将我引用到 Design doc 之外,我还在寻找文档、指南、代码、示例或某些方向。我正在寻找更多关于如何正确适应这种新的 Android 设计模式的实际代码,而不仅仅是关于它们的外观的想法。
导航抽屉
<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">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>
文本视图
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/activatedBackgroundIndicator"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="Loading Content ..."
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="#000000" />
【问题讨论】:
-
这里是“Android Design in Action: Navigation Drawers”youtube.com/watch?v=F5COhlbpIbY的链接。
-
给出的示例与“他们的外观想法”有何不同?导航抽屉通常只是样式精美的
ListView,因此任何关于后者的教程都应该这样做。有很多“在那里”,包括说明如何为行项目使用自定义布局的堆(这可能会让你至少走到一半)。
标签: android xml android-listview navigation-drawer