设置首选项屏幕的边距

问题描述 投票:0回答:1

我在Preference Fragment Compat中有一个首选项屏幕,它是主要活动托管的四个片段之一,我通过底部导航视图在它们之间切换。问题是我的一些偏好在底部导航视图下无法访问!如何在首选项屏幕中添加一些底部边距并解决问题?这是我的偏好屏幕,我尝试了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>
android
1个回答
0
投票

我假设您在FrameLayout中添加了Fragment,您只需将边距添加到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>
© www.soinside.com 2019 - 2024. All rights reserved.