RelativeLayout 的最大高度必须是所有屏幕高度的 50%。并且如果body layout的高度超过50%,则相对布局高度必须降低。我不明白如何将相对布局 max_height 设置为 50%。谢谢。屏幕xml代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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">
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/guide_line">
<LogoView
android:id="@+id/logo_view"
android:layout_width="match_parent"
android:layout_height="144dp"
android:layout_alignParentBottom="true"
app:lv_textColor="@android:color/white" />
</RelativeLayout>
<android.support.constraint.Guideline
android:id="@+id/guide_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
<FrameLayout
android:id="@+id/fl_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="@+id/guide_line" />
</android.support.constraint.ConstraintLayout>
更新:我添加了指南,但如果我的 framelayout 高度超过 50%,relativeLayout 高度必须降低,但事实并非如此:framelayout 的内容离开屏幕
