2013-05-07 4 views
0

How can I change font size in PreferenceScreenРазмер шрифта в предпочтении

Я пытаюсь сделать выше ... Он работает как шарм, однако мой SwitchPreference, что я не буду использовать больше не имею их кнопку переключения. Как я могу вернуть кнопку?

<?xml version="1.0" encoding="utf-8"?> 
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > 

    <PreferenceCategory 
     android:title="@string/pref_user_profile" 
     android:textSize="20px" 
     android:layout="@layout/pref_layout"> 

     <SwitchPreference 
       android:title="@+string/pref_frequency" 
       android:summary="@+string/pref_frequency_summary" 
       android:key="frequency" 
       android:defaultValue="true" 
      android:layout="@layout/pref_layout"/> 

     <SwitchPreference 
       android:title="@+string/pref_time" 
       android:summary="@+string/pref_time_summary" 
       android:key="time" 
       android:defaultValue="true" 
      android:layout="@layout/pref_layout"/> 

     <SwitchPreference 
       android:title="@+string/pref_symptothermal" 
       android:summary="@+string/pref_symptothermal_summary" 
       android:key="symptothermal" 
       android:defaultValue="true" 
      android:layout="@layout/pref_layout"/> 

     <SwitchPreference 
       android:title="@+string/pref_cervical_mucus" 
       android:summary="@+string/pref_cervical_mucus_summary" 
       android:key="cervical_mucus" 
       android:defaultValue="true" 
      android:layout="@layout/pref_layout"/>  

     <SwitchPreference 
       android:title="@+string/pref_mucus_stamps" 
       android:summary="@+string/pref_mucus_stamps_summary" 
       android:key="mucus_stamps" 
       android:defaultValue="true" 
      android:layout="@layout/pref_layout"/> 

     <SwitchPreference 
       android:title="@+string/pref_fertile_infertile" 
       android:summary="@+string/pref_fertile_infertile_summary" 
       android:key="fertile_infertil" 
       android:defaultValue="true" 
      android:layout="@layout/pref_layout"/> 
    </PreferenceCategory> 

</PreferenceScreen> 

И

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <TextView android:id="@+android:id/title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="15sp"/> 

    <TextView android:id="@+android:id/summary" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="12sp"/> 

</LinearLayout> 

ответ

0

Я нашел этот маленький надрез, который установил его

<LinearLayout 
    android:id="@+android:id/widget_frame" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    android:minWidth="48dp" 
    android:orientation="vertical" /> 
1

Завершая ответ ...
Макет должен содержать TextView с идентификатором «@ + android: id/title ", второй с id " @ + android: id/summary " и fin (и, самое главное,) для компонента предпочтения с идентификатором "@ + android: id/widget_frame". Вот мое предложение.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:baselineAligned="false" 
    android:padding="10dp" 
    android:weightSum="100" > 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="50" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+android:id/title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 

     <TextView 
      android:id="@+android:id/summary" 
      style="@style/SmallText" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="@android:color/darker_gray" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+android:id/widget_frame" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:minWidth="64dp" 
     android:orientation="vertical" 
     android:layout_weight="50" /> 
</LinearLayout> 

Вы должны знать, как правильно поместить два текстовых поля.

Смежные вопросы