繁体   English   中英

PreferenceFragment布局值

[英]PreferenceFragment layout values

我正在创建一个带有主菜单的应用程序,这些菜单项之一将打开一个PreferenceFragment。 为了在应用程序内创建统一性,我希望主菜单看起来尽可能靠近PreferenceFragment。 基本上,我可以用来创建与PreferenceFragment中的菜单项相似的所有菜单项的xml值。

我需要的值示例 :文本大小和颜色(用于标题和摘要文本)以及填充值。

我可能会猜到,但这可能需要一段时间,而且可能不准确。 必须有更好的方法来做到这一点。

这是我到目前为止的内容:
主菜单 (我想要看起来像PreferenceFragment的菜单): http : //i.imgur.com/O5jr14e.png
首选项 (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返回带有所需String值的上述布局,并将其显示在列表中。

提前致谢!

如果您希望整个应用程序中的文本大小和颜色相同,则应使用主题和样式。

http://developer.android.com/guide/topics/ui/themes.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM