android - 如何制作工具栏,使其始终位于其下的所有视图和布局之上?
问题描述
我目前在活动中有一个工具栏和一个 FrameLayout。问题是在运行时,FrameLayout 扩展并覆盖了我不想要的工具栏。我应该如何修改工具栏以使其位于其下所有视图的顶部?
布局文件:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
mapbox:layout_constraintBottom_toTopOf="@id/frameLayout"
mapbox:layout_constraintLeft_toLeftOf="parent"
mapbox:layout_constraintRight_toRightOf="parent"
mapbox:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="600dp"
mapbox:layout_constraintBottom_toBottomOf="parent"
mapbox:layout_constraintEnd_toEndOf="parent"
mapbox:layout_constraintStart_toStartOf="parent"
mapbox:layout_constraintTop_toBottomOf="@id/toolbar"
android:paddingTop="2dp">
// Map here.
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
解决方案
推荐阅读
- javascript - 为什么 AWS lambda 使用 nodejs 和 excel4node 生成损坏的 excel 文件
- android - laravel API,我如何发送令牌?
- javascript - 在 JavaScript ES6 中,如果 console.log() 不调用 obj.toString(),它有什么用?
- python - 使用从模型填充的数据的 Django 加载表单
- ios - 自定义 UILabel、UIButton 类的 viewWillAppear 替代方案
- php - Wordpress 排队插件脚本未在前端加载
- c - 谁能告诉我为什么这段代码不起作用并保持打印 0.00 公里作为最短距离?
- java - MVVM - 在模型类中获取上下文
- python - 每次出现时如何保留numpy数组的最新元素
- javascript - 与 bcrypt.compare 一起使用时,resp.cookie 不起作用