簡體   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