【发布时间】:2018-05-06 14:18:38
【问题描述】:
我想为我的应用程序提供一个圆形按钮颜色选择器,如下所示。
我尝试过的是这个。创建这么多具有不同背景颜色的圆形按钮。好像效率有点低。单击按钮将选择颜色。有一个更好的方法吗 ?
//rounded.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ff0000" />
<corners android:bottomRightRadius="35dp"
android:bottomLeftRadius="35dp"
android:topRightRadius="35dp"
android:topLeftRadius="35dp"/>
</shape>
//In Layout
<Button
android:id="@+id/button2"
android:layout_width="70dp"
android:layout_height="70dp"
android:background="@drawable/roundedbutton"
android:text="Button" />
【问题讨论】:
标签: android color-picker