首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PreferenceFragment布局值

PreferenceFragment布局值
EN

Stack Overflow用户
提问于 2014-11-18 19:36:12
回答 1查看 612关注 0票数 0

我正在创建一个带有主菜单的应用程序,其中一个菜单项将打开一个PreferenceFragment。为了在应用程序中创建统一,我希望主菜单看起来尽可能接近PreferenceFragment。基本上,我可以使用的所有xml值都创建与PreferenceFragment中类似的菜单项。

值示例,我需要:文本大小和颜色(包括标题和摘要文本)和填充值。

我可以猜到,但这可能需要一段时间,而且可能不准确。一定有更好的方法。

以下是我到目前为止所拥有的:

主菜单(我想要看上去像PreferenceFragment的菜单):http://i.imgur.com/O5jr14e.png

Preferences ( PreferenceFragment):http://i.imgur.com/YLUnNdX.png

下面是到目前为止菜单项的布局值:

代码语言:javascript
复制
<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返回上述布局,并将其显示在列表中。

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2014-11-18 19:44:26

你应该使用主题和样式,如果你正在寻找文本大小和颜色是相同的整个应用程序。

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27002539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档