사용하여 배경 만들기 : 내가했습니다 무엇이를 통해 내가 일반적으로 할 것입니다 상자 버튼과 레이블을 포함하고 흰색 스크림을 가진 같은 것을 만들 ConstraintLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom=true
android:background="#99ffffff
android:gravity="center_horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button Text"
android:layout_margin="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Label Text"
android:layout_margin="8dp"/>
</LinearLayout>
</RelativeLayout>
을 완료했다 :
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/scrim
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#99ffffff"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="@+id/button"/>
<Button
android:id="@+id/button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@+id/label"/>
<TextView
android:id="@+id/label
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</android.support.constraint.ConstraintLayout>
하단의 부모와 버튼의 상단에 제한된 스크림보기, 부모의 하단에있는 TextView와 TextView의 상단에있는 버튼을 만드는 것이 아이디어입니다 .
스크림은 버튼의 여백을 고려하지 않습니다. 즉, 스크림 상단이 버튼 위의 8dp가 아닌 버튼의 상단과 같은 높이가됩니다.