设置首选项屏幕的边距

时间:2018-09-13 17:32:47

标签: android

我在“首选项片段兼容性”中有一个首选项屏幕,该屏幕是主要活动托管的四个片段之一,并通过底部导航视图在它们之间切换。问题是我的某些首选项位于底部导航视图下并且无法访问!如何在首选项屏幕上添加一些底边距并解决问题?这是我的偏好设置屏幕,我尝试了android:layout_marginBottom="57dp",但没有用。

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginBottom="57dp">

<!-- my preferences -->

</android.support.v7.preference.PreferenceScreen>

1 个答案:

答案 0 :(得分:0)

我假设您要在FrameLayout中添加片段,您可以简单地在FrameLayout中添加边距!

如果不是这样,您应该这样做-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <android.support.design.widget.AppBarLayout 
        xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/appbar"
        app:theme="@style/ThemeOverlay.AppCompat.Dark">

        <android.support.v7.widget.Toolbar 
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?colorPrimary"
            app:elevation="5dp"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:id="@+id/content_wrapper"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="10dp"/>

</LinearLayout>
相关问题