在布局的基线上添加按钮
Adding a button on the baseline of a layout
如何将按钮放置在布局的基线上,如下图所示
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="7dp"
app:cardElevation="22dp">
</android.support.v7.widget.CardView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@+id/cardView"
app:srcCompat="@drawable/ic_facebook"
app:layout_anchorGravity="center|bottom" />
</android.support.design.widget.CoordinatorLayout>
如何将按钮放置在布局的基线上,如下图所示
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="7dp"
app:cardElevation="22dp">
</android.support.v7.widget.CardView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@+id/cardView"
app:srcCompat="@drawable/ic_facebook"
app:layout_anchorGravity="center|bottom" />
</android.support.design.widget.CoordinatorLayout>