1

質問:

設定メニューに設定項目がリストされているときに、android:title 属性に使用されるテキスト サイズを変更するにはどうすればよいですか?

詳細:

私のアプリの設定画面は、Nexus 7 (Jelly Bean) タブレットでは見栄えがしますが、Motorola Defy (Gingerbread) スマートフォンではほとんど使用できません。Android Dev ガイドで詳しく説明されているように、標準の PreferenceActivity アプローチを使用しています。

私は数日間 Web を検索してきましたが、見た目を変える解決策は見つかりませんでした。

Android-Gingerbread フォンで。

1)<EditTextPreference android:title .../>テキストが大きすぎて、ワードラップされていません。

2) 各設定項目の横にある標準の「下向き矢印」アイコンが奇妙でずれているように見えます。(アイコン画像のズレ)

3) テーマはホロですが、最後の設定項目の下にある大きな空白領域が、何らかの理由で醜いライト グレーになっています。

style.xml リソースを定義して、preferences.xml に style="@style/StyleName" を入れて android:textSize 属性を変更しようとしましたが、何もしませんでした。

以下は、私の設定画面の XML です。

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

    <PreferenceCategory 
        android:key="pref_key_mixProportions" 
        android:title="@string/pref_title_mixProportions"
        style="@style/SettingsMenu"
        >
        <EditTextPreference 
            android:key="pref_key_binderPortion"
            android:title="@string/pref_title_binderPortion"
            android:dialogTitle="Binder Portion"
            android:inputType="numberDecimal"
            android:maxLines="2"
            android:scrollHorizontally="false"
            android:defaultValue="1"
            android:persistent="true" />

        <EditTextPreference 
            android:key="pref_key_premixPortion"
            android:title="@string/pref_title_premixPortion"
            android:dialogTitle="Premix Portion"
            android:inputType="numberDecimal"
            android:layout_width="wrap_content"
            android:maxLines="2"
            android:scrollHorizontally="false"
            android:defaultValue="5"
            android:persistent="true"/>
    </PreferenceCategory>

    <PreferenceCategory 
        android:key="pref_key_binderProperties" 
        android:title="@string/pref_title_binderProperties">
        <EditTextPreference 
            android:key="pref_key_binderDensity"
            android:title="@string/pref_title_binderDensity"
            android:dialogTitle="Density of Binder powder (kg/m^3)"
            android:inputType="numberDecimal"
            android:defaultValue="2850"
            android:persistent="true"
            android:summary="@string/pref_summary_binderDensity"/>
        <EditTextPreference 
            android:key="pref_key_binderBagWeight"
            android:title="@string/pref_title_binderBagWeight"
            android:dialogTitle="Weight of Binder per bag (kg)"
            android:inputType="numberDecimal"
            android:defaultValue="20"
            android:persistent="true" />

    </PreferenceCategory>

    <PreferenceCategory 
        android:key="pref_key_premixProperties" 
        android:title="@string/pref_title_premixProperties">
        <EditTextPreference 
            android:key="pref_key_premixDensity"
            android:title="@string/pref_title_premixDensity"
            android:dialogTitle="Density of Sand and Aggregate Mix (kg/m^3)"
            android:inputType="numberDecimal"
            android:defaultValue="1850"
            android:persistent="true"
            android:summary="@string/pref_summary_premixDensity"/>

    </PreferenceCategory>

</PreferenceScreen>

私のstyles.xmlには以下が含まれています:

<style name="SettingsMenu">
    <item name="android:textSize">15sp</item>
</style>

ただし、サイズにどのような値を指定しても、テキストは同じように見えます。

一部の人々が使用を提案しているのを見て<PreferenceScreen android:layout=".... />きましたが、これがどのように行われるかについての明確な説明は見つかりませんでした.

誰でも助けることができますか?

4

1 に答える 1

0

スタイル ファイルを設定アクティビティの横にあるマニフェスト宣言に追加します。

<activity
    android:name="com.example.PrefsActivity"
    android:theme="@style/PreferencesStyle" >
</activity>

それはトリックを行います

于 2013-10-01T20:46:20.787 に答える