我正在创建一个带有主菜单的应用程序,其中一个菜单项将打开一个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>我使用带有自定义ListFragment的ListAdapter返回上述布局,并将其显示在列表中。
提前感谢!
发布于 2014-11-18 19:44:26
你应该使用主题和样式,如果你正在寻找文本大小和颜色是相同的整个应用程序。
http://developer.android.com/guide/topics/ui/themes.html
https://stackoverflow.com/questions/27002539
复制相似问题