gpt4 book ai didi

android - android 5.0 中的布局对齐问题

转载 作者:搜寻专家 更新时间:2023-11-01 08:45:35 24 4
gpt4 key购买 nike

我有一个布局,其中一个按钮在 RelativeLayout 的底部对齐,如下面的代码所示:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="250dp"
android:background="@color/background_material_light"
android:layout_height="match_parent">

<View
android:layout_alignParentLeft="true"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/strokeColor"/>

<RelativeLayout
android:id="@+id/rlHeaderFilter"
android:layout_width="match_parent"
android:layout_height="@dimen/abc_action_bar_default_height_material">

<View
android:id="@+id/separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/strokeColor"/>

<TextView
android:background="@color/actionbar_background"
android:id="@+id/tvFilterText"
style="@style/textStyleHeading2"
android:layout_toRightOf="@+id/separator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textColor="@color/white"
android:text="Filter Search" />

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:src="@drawable/refresh"
android:id="@+id/resetLeadsFilter"
android:contentDescription="@string/emptyString"
android:layout_centerVertical="true"
android:padding="6dp"/>

</RelativeLayout>

<TextView
android:layout_below="@+id/rlHeaderFilter"
android:layout_marginTop="10dp"
android:id="@+id/tvBudgetFromFilter"
style="@style/textSpinnerStyleHeading"
android:layout_margin="8dp"
android:hint="Budget From"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:layout_below="@+id/tvBudgetFromFilter"
android:layout_marginTop="10dp"
android:id="@+id/tvBudgetToFilter"
style="@style/textSpinnerStyleHeading"
android:layout_margin="8dp"
android:hint="Budget To"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<include
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_below="@+id/tvBudgetToFilter"
android:id="@+id/sourceLayout"
layout="@layout/source_layout" />

<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/statusLayout"
android:layout_margin="8dp"
android:layout_below="@+id/sourceLayout"
layout="@layout/status_layout" />

<Button
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:layout_marginTop="10dp"
android:textColor="@color/white"
android:background="@color/actionbar_background"
android:text="SEARCH"
android:id="@+id/bFilterLeads"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>

我可以看到布局底部的按钮,如屏幕截图所示。它在 Lollipop 之前的设备(低于 < 5.0 设备)中显示如下:

enter image description here

但是在 Lollipop 中底部的按钮并没有出现,如下图所示:

enter image description here

我无法得到原因请帮助我。提前致谢 。

最佳答案

我的问题已经解决了!事实上,LinearLayout 在 navigationBar 的后面。要修复它,只需将此行添加到 Activity(在 setContentView(); 之后)

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);

关于android - android 5.0 中的布局对齐问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28678555/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com