猿问

布局从屏幕的顶部到底部

我有一个屏幕,其中有一个操作栏,然后是一本书的标题和章节本身。问题是,章节从上到下,标题被截断。章节文本还与顶部的应用栏和底部的底部导航视图重叠。请帮忙


内容主页


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


慕沐林林
浏览 106回答 1
1回答

白衣非少年

试试这个作为 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&nbsp; &nbsp; android:id="@+id/liner_layout"&nbsp; &nbsp; android:orientation="vertical"&nbsp; &nbsp; android:layout_height="match_parent"&nbsp; &nbsp; android:layout_width="match_parent"&nbsp; &nbsp; >&nbsp; &nbsp; <androidx.appcompat.widget.Toolbar&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/toolbar"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="match_parent"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="?attr/actionBarSize"&nbsp; &nbsp; &nbsp; &nbsp; android:background="@color/colorPrimary"&nbsp; &nbsp; &nbsp; &nbsp; app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />&nbsp; &nbsp; <include&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/include"&nbsp; &nbsp; &nbsp; &nbsp; layout="@layout/content_home"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="match_parent"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_behavior="@string/appbar_scrolling_view_behavior"/></LinearLayout><com.google.android.material.bottomnavigation.BottomNavigationView&nbsp; &nbsp; android:id="@+id/bottomNavigationView"&nbsp; &nbsp; android:layout_width="match_parent"&nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; app:menu="@menu/nav_menu"&nbsp; &nbsp; android:layout_alignParentBottom="true" />保持 content_home 布局不变。
随时随地看视频慕课网APP

相关分类

Java
我要回答