3

フラグメント スタイルで実装された単一ページの設定を持つ単純なアプリがあります。Android 4.x (いくつかのバージョン) を搭載したタブレットで実行しています。設定ページを開くと、アクション バーが一番上の設定項目を隠してしまいます。私の回避策は、ダミーの最初のアイテムを用意することですが、もちろんこれはばかげています。アクションバーを保持し、設定をアクションバーの下から開始する方法がわかりません。アクションバー用にプログラミングしているのではなく、表示されるだけです。

問題のスクリーンショット

Preferences.xml:

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

    <CheckBoxPreference
        android:key="pref_AdaptToRoomXXX"
        android:title="This is the dummy item as a spacer" />

    <CheckBoxPreference
        android:key         ="@string/pref_TimeFormat"
        android:title       ="@string/action_setTimeFormat"
        android:summary     ="@string/action_setTimeFormat"
        />

    <ListPreference 
        android:key="@string/pref_DateFormat"
        android:title="@string/action_setDateFormat"
        android:summary="@string/action_setDateFormat"
        android:dialogTitle="@string/action_setDateFormat"
        android:entries="@array/action_setDateFormat_options"
        android:entryValues="@array/action_setDateFormat_values"
        android:defaultValue="@string/action_setDateFormat_default" />

    <ListPreference 
        android:key="@string/pref_TextColor"
        android:title="@string/action_setTextColor"
        android:summary="@string/action_setTextColor"
        android:dialogTitle="@string/action_setTextColor"
        android:entries="@array/action_setTextColor_colors"
        android:entryValues="@array/action_setTextColor_values"
        android:defaultValue="@string/action_setTextColor_default" />

    <CheckBoxPreference
        android:key="@string/pref_DimOnBattery"
        android:title="@string/action_setDimOnBattery"
        android:defaultValue="true" />

</PreferenceScreen>

助言がありますか?

4

4 に答える 4

3

通常ActionBar、コンテンツをオーバーレイしないでください。ウィンドウに設定さWindow.FEATURE_ACTION_BAR_OVERLAYれているかどうかを確認します。つまり...

requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

... アクティビティ内で呼び出されます。もしそうなら - それを削除します。

これが役に立てば幸いです...乾杯!

于 2013-05-15T20:31:08.090 に答える
1

私の解決策は、レイアウト ファイルのコンテナにapp:layout_behavior属性を追加することでした。<FrameLayout />PreferenceFragment

<FrameLayout
    android:id="@+id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />
于 2016-02-12T23:47:46.733 に答える
0

私の問題は、これらの2つの属性をstyles.xmlに追加することで解決されます

<!-- Make setting content not covering by actionbar -->
<item name="android:fitsSystemWindows">true</item>
<item name="android:clipToPadding">true</item>
于 2014-08-22T07:03:05.783 に答える