【发布时间】:2014-11-18 19:36:12
【问题描述】:
我正在创建一个带有主菜单的应用程序,其中一个菜单项将打开一个 PreferenceFragment。为了在应用程序中创建统一性,我希望主菜单看起来尽可能接近 PreferenceFragment。基本上,我可以使用所有 xml 值来创建类似于 PreferenceFragment 中的菜单项。
我需要的值示例:文本大小和颜色(用于标题和摘要文本)以及填充值。
我可以猜到,但这可能需要一段时间,而且可能不准确。必须有更好的方法来做到这一点。
这是我目前所拥有的:
主菜单(我希望该菜单看起来像 PreferenceFragment):http://i.imgur.com/O5jr14e.png
Preferences( PreferenceFragment):http://i.imgur.com/YLUnNdX.png
这里是我到目前为止菜单项的布局值:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="wrap_content" android:id="@+id/menu_item"
android:orientation="vertical" android:layout_weight="1"
android:paddingLeft="10dp">
<TextView android:id="@+id/menu_item_title"
android:textSize="20sp"
android:textColor="@android:color/white"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView android:id="@+id/menu_item_description"
android:textColor="@android:color/darker_gray"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
我正在使用带有自定义 ListAdapter 的 ListFragment 来返回带有所需字符串值的上述布局并将其显示在列表中。
提前致谢!
【问题讨论】:
标签: java android layout styles