将 ConstraintLayout 内的 FrameLayout 对齐到底部

Align FrameLayout inside ConstraintLayout to bottom

我想要屏幕底部回收站视图上方的布局(如框架),这样即使该布局可见,我仍然可以在其后面滚动回收站视图。所以我想对齐屏幕底部的框架布局,并根据需要使其可见和不可见。这是我的代码。

 <?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"
    tools:context="com.protossoft.root.aesencryption.MainActivity">



    <ListView
        android:layout_width="match_parent"
        android:id="@+id/listView"
        android:layout_height="match_parent">

    </ListView>

  <!--  <RelativeLayout
        android:layout_width="match_parent"

        android:layout_height="wrap_content">-->
    <FrameLayout
        android:layout_width="match_parent"

        android:layout_height="wrap_content"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="443dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:gravity="center"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/deviceNumberImage"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.2"
                android:src="@android:drawable/btn_default" />

            <TextView
                android:id="@+id/deviceNumber"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.8"
                android:text="990000862471854" />

        </LinearLayout>
    </FrameLayout>
   <!-- </RelativeLayout>-->

我对约束布局没有太多的想法,但是当我从编辑器移动底部的视图时,它正在使用 属性 like

tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="443dp"

我想用一些 属性 来达到同样的效果,比如 align_parentBottom。但是 none 的属性可供使用。我需要做什么才能使框架布局同时在回收站视图的底部和顶部可见? 谢谢:)

I want to achieve the same with some property like align_parentBottom.

您应该使用 app:layout_constraintBottom_toBottomOf="parent" 属性。

这是您需要的设置:

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">
        ...
    </FrameLayout>

</android.support.constraint.ConstraintLayout>