1
我有类似下面定义的按钮:到按钮添加图标,自定义样式
<Button
android:id="@+id/fab"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@drawable/my_style"
android:src="@drawable/ic_register_fab"
android:layout_gravity="end|bottom"
android:layout_marginRight="15dp"
android:layout_marginBottom="15dp"
/>
my_style.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
>
<solid android:color="@color/path_primary"/>
<stroke
android:width="2dp"
android:color="@color/white"
/>
</shape>
时,我想的图标添加到我的按钮把android:src="..."
在main_activity.xml和my_style.xml中都不起作用
如何为我的按钮设置图标? 谢谢。