【问题标题】:Adding a button on the baseline of a layout在布局的基线上添加按钮
【发布时间】:2018-06-16 14:04:23
【问题描述】:

如何在布局的基线上放置一个按钮,如下图所示

【问题讨论】:

  • 使用协调器布局作为父布局,并为您的按钮添加锚点重力。
  • 我会去ConstraintLayout

标签: android material-design android-coordinatorlayout layout-anchor


【解决方案1】:
 <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>

【讨论】:

    猜你喜欢
    • 2016-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-22
    • 1970-01-01
    相关资源
    最近更新 更多