Установить пользовательскую строку заголовка в PreferenceAcctivity

я та же проблема, как этот вопрос:Пользовательская строка заголовка в PreferenceActivity?

После продленияPreferenceActivityЯ пишу этот код вonCreate(), это просто показывает пустой серый заголовок. Я думаю, что это ошибка (потому что это решение хорошо работает с Activity).

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.main_pref);

отредактированный:

window_title.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:background="@color/titleBar" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical" 
    android:paddingLeft="5dip" 
    android:paddingRight="5dip">

    <ImageView android:id="@+id/imageView1" 
               android:src="@drawable/megadict_icon" 
               android:layout_height="35dip" 
               android:layout_width="35dip" 
               android:layout_gravity="center_vertical" />

    <TextView android:layout_width="wrap_content" 
              android:id="@+id/textView1" 
              android:layout_height="wrap_content" 
              android:textColor="@color/white" 
              android:textSize="16dip" 
              android:layout_weight="1" 
              android:layout_gravity="center_vertical" 
              android:text="@string/appName" 
              android:paddingLeft="5dip" 
              android:paddingRight="5dip" />

    <ProgressBar style="?android:attr/progressBarStyleSmall" 
                 android:id="@+id/progressBar" 
                 android:layout_width="28dip" 
                 android:layout_height="28dip" 
                 android:layout_gravity="center_vertical" 
                 android:visibility="invisible" />

</LinearLayout>

main_pref.xml

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

    <ListPreference android:entries="@array/languageStrings" 
                    android:entryValues="@array/languageValues" 
                    android:dialogTitle="@string/languagePrefTitle" 
                    android:title="@string/mainPrefTitle" 
                    android:key="languagePrefKey" />

</PreferenceScreen>

Ответы на вопрос(2)

Ваш ответ на вопрос