【问题标题】:Cardview with button at bottom [duplicate]Cardview底部有按钮[重复]
【发布时间】:2020-10-09 16:23:12
【问题描述】:

我想创建这样的布局

但我无法在卡片视图上方安排按钮。请帮帮我。

【问题讨论】:

标签: android xml


【解决方案1】:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <androidx.cardview.widget.CardView
        android:id="@+id/cardView"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:layout_centerHorizontal="true"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp"
        android:layout_marginEnd="10dp" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_below="@id/cardView"
        android:layout_centerHorizontal="true"
        android:layout_marginStart="16dp"
        android:layout_marginTop="-15dp"
        android:layout_marginEnd="16dp"
        android:backgroundTint="#48C1F6"
        android:text="Boost" />

</RelativeLayout>

【讨论】:

    猜你喜欢
    • 2021-05-01
    • 2019-01-18
    • 2015-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-12
    相关资源
    最近更新 更多