答案 0 :(得分:0)
您可以像这样创建这种类型的设计:
创建如下所示的布局
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/custom_button"
android:drawableLeft="@drawable/ic_calender"
android:text="button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/custom_button"
android:drawableLeft="@drawable/ic_calender"
android:text="button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/custom_button"
android:drawableLeft="@drawable/ic_calender"
android:text="button 1" />
</LinearLayout>
</LinearLayout>
现在在res / drawable目录中创建这个可绘制的custom_button
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:width="2dp" android:color="@color/colorPrimary" />
<corners android:radius="50dp" />
<solid android:color="@color/colorPrimary" />
</shape>
</item>