Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increasing CheckboxPreference title and summary text size and glowing of an preference entry

Hi I am working on Message Settings as a preference.

I am trying to change android:title and android:summary text font size of CheckboxPreference.

enter image description here

For this I am trying out the below code

   <PreferenceCategory
    android:key="prefcategory1"
    android:title="GENERAL SETTINGS..." >

    <CheckBoxPreference
        android:defaultValue="false"
        android:enabled="true"
        android:key="checkBoxdelete"
        android:layout="@layout/mylayout"     <!--linking it to mylayout.xml -->
        android:summary="Deletes old messages as limits are reached"
        android:title="Delete old messages" />
  </PreferenceCategory>

and mylayout.xml

<TextView android:id="@+android:id/title"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:paddingLeft="8dp"
    android:textColor="#FFFFFF"
    android:textSize="30px"
    android:textStyle="bold"/>  

<TextView android:id="@+android:id/summary"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:paddingLeft="8dp"
    android:textColor="#FFFFFF"
    android:textSize="20px"
    android:textStyle="bold"/>

By using this, the text size is increased as in below screen shot.But, I am not able to see the checkbox..How do I resolve this?

enter image description here

like image 329
sanjana Avatar asked Sep 13 '13 13:09

sanjana


1 Answers

Most of the answers here are outright wrong or too complex to implement when there are simpler ways to do the same.

Just for future readers - You can change the textSize/ textColor in your styles.xml

   <style name="PreferencesTheme" parent="@android:style/Theme.Black">
            <item name="android:textSize">34sp</item>
            <item name="android:textColorSecondary">#000000</item>
            <item name="android:textColorPrimary">#000000</item>
    </style>

where textColorPrimary will change the color of title of checkBoxPreference and textColorSecondary will change the color of summary.

like image 54
bhaskarc Avatar answered Nov 01 '22 17:11

bhaskarc