android - 工具栏盲片
问题描述
我的项目我使用工具栏但工具栏盲片段
如何解决这个问题 sry 这段代码详细信息 ry 这段代码详细信息 ry 这段代码详细信息 ry 这段代码详细信息 ry 这段代码详细信息 ry 这段代码详细信息 ry 这段代码详细信息详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息ry 这段代码详细信息代码详情 ry 这段代码详情 ry 这段代码详情 ry 这段代码详情 ry 这段代码详情 ry 这段代码详情 ry 这段代码详情 ry 这段代码详情 ry 这段代码详情
并在此处输入图像描述您可以排除边距吗?
这个代码我怎么能改变这个?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:elevation="2dp"
android:minHeight="?attr/actionBarSize"
android:background="@drawable/ic_bar_start">
</Toolbar>
<fragment
android:id="@+id/map_viewer_start"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
tools:context=".fragment.StartFragment" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp">
<Button
android:id="@+id/mainStartRunning"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="RUNNING"
style="@style/buttonTextRedText"
android:background="@drawable/button_empty_background"
android:onClick="onClick"
android:layout_margin="10dp"
android:gravity="center"/>
<Button
android:id="@+id/mainStartRacing"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="RACING"
style="@style/buttonText"
android:background="@drawable/button_background"
android:onClick="onClick"
android:layout_margin="10dp"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
解决方案
使用如下layout_below
属性_RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Toolbar
android:id="@+id/toolbar"
android:layout_alignParentTop="true"
...>
</Toolbar>
<LinearLayout
android:layout_below="@+id/toolbar"
android:layout_above="@+id/bottom_layout"
...>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_layout"
android:layout_alignParentBottom="true"
...>
</LinearLayout>
</RelativeLayout>
或LinearLayout
与orientation
垂直使用
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Toolbar
...>
</Toolbar>
<LinearLayout
...>
</LinearLayout>
推荐阅读
- sql - 连接两个没有唯一标识符的数据表
- c++ - 动态绑定和虚函数——基类对象的向量,访问“正确”的成员函数
- regex - 验证特定标识符模式
- sql - 如何在 SQL 中获取日期差异?
- javascript - 从 JS(浏览器)创建和下载一个 UTF8 纯文本文件
- azure-data-factory - 如何将CSV复制到ADF中具有带点的列标题的Json?
- sql - SQL BigQuery - 在“IN”子句中使用 WITH 视图
- php - 将 2 个表中的 2 个不同 id 保存到另一个表中
- git - 将 git 浅克隆转换为部分克隆
- substrate - 错误:特征绑定 `types::DepartmentDetails: scale_info::TypeInfo` 不满足