android - Changing Text Color of Specific PreferenceScreen in PreferenceFragment -


so have preferencefragment couple of preferences in there so:

<preferencescreen xmlns:tools="http://schemas.android.com/tools"               xmlns:android="http://schemas.android.com/apk/res/android">     <preferencecategory         android:title="menu"         android:key="menu">          <preferencescreen             android:title="pref1"             android:key="pref1" />          <preferencescreen             android:title="pref2"             android:key="pref2" />     </preferencecategory> </preferencescreen> 

if want change color of "pref2" can red, how it? i've looked @ couple of different solutions. 1 of them create it's own layout. tried that:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="horizontal">      <textview         android:textcolor="#ff0000"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:text="pref2"         android:layout_alignparenttop="true"         android:layout_alignparentend="true"/> </relativelayout> 

and doesn't work because margin off, height wrapped instead of matching parent, , size seems off well. suggestions?

in case wondering, hacky solution found create relativelayout , hardcode in textsize, margin, , height of textview

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"                 android:id="pref2"                 android:layout_width="match_parent"                 android:layout_height="50dp"                 android:orientation="horizontal">      <textview         android:textcolor="#ff0000"         android:textsize="16sp"         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:text="@string/menu_sign_out_text"         android:layout_marginstart="16dp"         android:gravity="center"/> </relativelayout> 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -