RelativeLayout在v7支持库中似乎不太好用。我有三个元素,一个与底部对齐,另外两个在它上面堆叠。它们不会显得很好地堆叠在底部,而是在屏幕外呈现,这是出乎意料的。
我已经添加了一个示例XML文件,该文件用于添加到工具栏的自定义视图。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/name"
android:layout_above="@+id/divider"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textColor="@color/textLighter"
android:text="@string/example_sequence_name"
android:singleLine="true" />
<View
android:id="@+id/divider"
android:layout_width="wrap_content"
android:background="@color/textLighter"
android:layout_above="@+id/description"
android:layout_height="81dp"/>
<EditText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_description"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle"
android:textColor="@color/textLighter"
android:layout_alignParentBottom="true"
android:singleLine="true" />
此视图中的结果。