androidandroid-preferencespreferencescreen

Preference screen display text block


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.


Solution

  • You cannot add a formatted textblock inside a PreferenceScreen, that's not what it's meant to be. However, you can add your About text inside another activity (a LinearLayout with some formatted TextViews may be enough). Call this by passing an intent inside the preference:

    <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >    
        <Preference 
            android:key="about"   
            android:title="About">           
                <intent android:action="your.package.path.to.Activity"/>           
        </Preference>
    </PreferenceScreen>