为了账号安全,请及时绑定邮箱和手机立即绑定

布局从屏幕的顶部到底部

布局从屏幕的顶部到底部

慕沐林林 2023-05-17 17:52:39
我有一个屏幕,其中有一个操作栏,然后是一本书的标题和章节本身。问题是,章节从上到下,标题被截断。章节文本还与顶部的应用栏和底部的底部导航视图重叠。请帮忙内容主页<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout 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"    app:layout_behavior="@string/appbar_scrolling_view_behavior"    tools:context=".activities.HomeActivity"    tools:showIn="@layout/activity_home">    <FrameLayout        android:id="@+id/frameLayoutHome"        android:layout_width="match_parent"        android:layout_height="match_parent">    </FrameLayout></androidx.constraintlayout.widget.ConstraintLayout>活动之家<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout 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"    tools:context=".activities.HomeActivity">    <androidx.appcompat.widget.Toolbar        android:id="@+id/toolbar"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:background="?attr/colorPrimary"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent"        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /></androidx.constraintlayout.widget.ConstraintLayout>
查看完整描述

1 回答

?
白衣非少年

TA贡献1155条经验 获得超0个赞

试试这个作为 activity_home 布局:


<?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"

tools:context=".HomeActivity">


<LinearLayout

    android:id="@+id/liner_layout"

    android:orientation="vertical"

    android:layout_height="match_parent"

    android:layout_width="match_parent"

    >

    <androidx.appcompat.widget.Toolbar

        android:id="@+id/toolbar"

        android:layout_width="match_parent"

        android:layout_height="?attr/actionBarSize"

        android:background="@color/colorPrimary"

        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


    <include

        android:id="@+id/include"

        layout="@layout/content_home"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>


</LinearLayout>


<com.google.android.material.bottomnavigation.BottomNavigationView

    android:id="@+id/bottomNavigationView"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:menu="@menu/nav_menu"

    android:layout_alignParentBottom="true" />

保持 content_home 布局不变。


查看完整回答
反对 回复 2023-05-17
  • 1 回答
  • 0 关注
  • 84 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信