Badr Hari Badr Hari - 1 year ago 119
Java Question

How to use textview in Android's PreferenceScreen?

I would like to use textview in PreferenceScreen, it's a longer text that explains some specific setting. If I use summary or title attribute on some versions it gets formatted weirdly, doesn't display correctly etc. (The text is rather long).

Therefor I find it would be the best to use textview, is it possible to create custom settings element?

Answer Source

You can assign layout resource for your preference in your xml file, using tag android:layout="@layout/your_pref_layout".

Don't forget to use proper ids in your layout (android:id="@+android:id/title", android:id="@+android:id/summary") to assign views to be used as title/summary views.

For more info see for example this: Creating a custom layout for preferences

or this: How to add a button to PreferenceScreen

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download