Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preference screen display text block

Tags:

I am trying to make a Preference screen that just has an about, contact, and legal option, all of which when clicked just show text blurb and icon in a separate page, no shared preferences or anything.

I am having trouble understanding the hierarchy in order to display the text. I would like the flow to be: settings -> about -> the about text

Currently I have this, which gives me the category and option, but I don't know what to make it in order to display new text.

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <PreferenceCategory
            android:title="Info">
        <Preference android:title="About"/>


    </PreferenceCategory>
...
</PreferenceScreen>

I don't know what option to use to make the about clickable into a textview.

like image 690
Nick Avatar asked Aug 09 '12 13:08

Nick


1 Answers

A.Grandt's solution gives really nice imitation of text block within Preference Activity, but I would add an android:persistent="false" attribute, which avoids storing unnecessarily this 'pseudo preference' into SharedPreferences file for your app's settings.

To sum up. Imitation of TextView within Preferences Activity as A.Grandt suggested would be:

<Preference
    android:key="pref_static_field_key"
    android:selectable="false"
    android:persistent="false"
    android:title="you can omit the title"
    android:summary="Multi line description\ncan go here."/>

Although you can use \n for line breaking, yet it won't resize the Preference Item itself, so there is a possibility that these multilines will not be fully visible within a still single-line Preference Item.

like image 90
Krzysiek Avatar answered Sep 24 '22 18:09

Krzysiek