最佳答案
这里有一些代码可以帮助您入门。让我们从背景开始。如果该背景未提供给您而您必须自己创建,请创建一个 custom_button_bg.xml 文件并添加到您的可绘制文件夹中。
custom_button_bg.xml 注意:我只是为你做了基本的形状。根据需要调整阴影和角半径
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/teal"
android:startColor="@color/teal"/>
<corners android:radius="4dp"/>
<stroke
android:width="1dp"
android:color="@color/shadow"/>
</shape>
现在只需创建您的布局,如下所示。只需替换 src 和标签即可。
<RelativeLayout
android:layout_width="160dp"
android:layout_height="80dp"
android:gravity="center_vertical"
android:background="@drawable/custom_rounded_white_button">
<ImageView
android:id="@+id/iv_video_cam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/video_cam"/>
<TextView
android:id="@+id/tv_desc"
android:layout_toRightOf="@+id/iv_video_cam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See a Medical \nDoctor Now"/>
<ImageView
android:layout_toRightOf="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow"/>
</RelativeLayout>
干杯!
关于带有两个图像和文本的 Android 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41046716/