简体   繁体   中英

PreferenceFragment layout values

I'm creating an app with a main menu, one of these menu items will open up a PreferenceFragment. To create unity within the app I'd like the main menu to look as close to the PreferenceFragment as possible. Basically all the xml values I can use to create menu items that look similar to those in the PreferenceFragment.

Examples of values I need : text size and color (for both title and summary text) and padding values.

I could guess at it but that could take awhile and may not be accurate. There has to be a better way to do it.

Here is what I have so far:
Main Menu (the menu I want to look like the PreferenceFragment): http://i.imgur.com/O5jr14e.png
Preferences (the PreferenceFragment): http://i.imgur.com/YLUnNdX.png

Here are the layout values I have so far the menu item:

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

I am using a ListFragment with a custom ListAdapter to return the above layout with the required String values and display it in the list.

Thanks in advance!

You should use themes and styles if you are looking for the text size and color to be the same throughout the app.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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