【发布时间】:2015-10-18 20:25:48
【问题描述】:
我正在尝试用图像制作一个圆形按钮,我还想为它们添加分隔符背景。我可以创建一个圆形按钮,但我不知道如何在此添加图像和分隔符。
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="4">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/round_button"
android:text="New Button"
android:id="@+id/button"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/round_button"
android:text="New Button"
android:id="@+id/button2"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/round_button"
android:text="New Button"
android:id="@+id/button3"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/round_button"
android:text="New Button"
android:id="@+id/button4"
android:layout_weight="1" />
</LinearLayout>
Round_button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape android:shape="oval">
<solid android:color="#0dbe00"/>
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="oval">
<solid android:color="#c20586"/>
</shape>
</item>
</selector>
我想要什么:
我有什么:
【问题讨论】:
标签: android android-studio material-design