android - 改成RelativeLayout后导航栏消失
问题描述
我的 AndroidStudio 使用 ConstraintLayout 作为默认布局,我在 XML 代码中将其更改为 RelativeLayout。最后,我再次放置了我需要的所有 UI。在其他活动中,布局仍然是 ConstraintLayout。我的计划是稍后将它们也更改为 RelativeLayout。
更改后我的问题是,Android 的导航栏消失了。见图片。 在此处输入图像描述
我的 XML 代码是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".MainActivity">
<EditText
android:id="@+id/passwordField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:hint="@string/password"
android:ems="10"
android:inputType="numberPassword"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:text="@string/login"
android:textSize="36sp"
/>
<Button
android:id="@+id/logInButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_centerInParent="true"
android:layout_below="@id/checkBox"
android:onClick="logIn"
android:text="@string/log_in"
/>
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_below="@id/passwordField"
android:onClick="showPassword"
android:text="@string/show_password"
/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_below="@+id/logInButton"
android:onClick="createNewAccount"
android:layout_centerInParent="true"
android:text="@string/create_account"
/>
<TextView
android:id="@+id/textForgotPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:textSize="18sp"
android:onClick="forgotPassword"
android:text="@string/forgot_the_password_click_here" />
</RelativeLayout>
有人可以告诉我我做错了什么吗?
先感谢您!
解决方案
推荐阅读
- java - 捕获错误后如何设置 servlet 响应代码?
- sql - SQL 查询不起作用 外键约束的格式不正确
- php - 需要内容安全策略帮助
- docker - Traefik 的“使用 docker-compose 的基本示例”不起作用
- javascript - Nz-Slider 格式化程序输入,nz-zorro-9.3.1
- python-sphinx - 我可以使用列表表创建多行单元格吗?
- android - 如何使用 gradle 检测依赖版本更改?
- format - 物联网传感器数据格式统一
- r - 获取具有随机截距和具有异质方差的连续一阶自回归相关结构的 varcov 矩阵 LMM?
- c# - 无法加载场景,因为它尚未添加到构建设置中