Android ActionBar与TextView重叠,约束Yout问题
操作栏与文本视图重叠。为什么?约束条件是正确的。它可以与RelativeLayout配合使用。我主要使用两个ConstraintLayout来添加一些不应该影响ActionBar的填充 代码:Android ActionBar与TextView重叠,约束Yout问题,android,android-constraintlayout,Android,Android Constraintlayout,操作栏与文本视图重叠。为什么?约束条件是正确的。它可以与RelativeLayout配合使用。我主要使用两个ConstraintLayout来添加一些不应该影响ActionBar的填充 代码: 将第二个约束调整高度更改为包裹内容,或者如果您想要全高,则将底部约束和高度设置为0dp,如下所示 将第二个约束调整高度更改为包裹内容,或者如果您想要全高,则将底部约束和高度设置为0dp,如下所示 将第二个约束更改为“包裹”内容,或者如果您想要全高,则将“底部约束”和“高度”设置为“0dp”更
将第二个约束调整高度更改为包裹内容,或者如果您想要全高,则将底部约束和高度设置为0dp,如下所示
将第二个约束调整高度更改为包裹内容,或者如果您想要全高,则将底部约束和高度设置为0dp,如下所示
将第二个约束更改为“包裹”内容,或者如果您想要全高,则将“底部约束”和“高度”设置为“0dp”更改第二个约束更改为“包裹”内容,或者如果您想要全高,则将“底部约束”和“高度”设置为“0dpI”有一个稍微不同的问题,但您的解决方案帮助我找到了解决方法!我有一个稍微不同的问题,但你的解决方案帮助我找到了出路!
<?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">
<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#ffffff"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="20dp"
app:layout_constraintTop_toBottomOf="@+id/my_toolbar"
android:layout_marginTop="10dp"
android:paddingRight="20dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:id="@+id/xxxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="xxxxxxx"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#000000"
app:layout_constraintTop_toTopOf="@+id/constraintLayout2"
app:layout_constraintStart_toStartOf="@+id/constraintLayout2"/>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#ffffff"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintTop_toBottomOf="@+id/my_toolbar"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/xxxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="xxxxxxx"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#000000"
app:layout_constraintStart_toStartOf="@+id/constraintLayout2"
app:layout_constraintTop_toTopOf="@+id/constraintLayout2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>