开发者

In Android, how can i allow the user to choose a color between 4?

开发者 https://www.devze.com 2022-12-27 20:38 出处:网络
I\'m making an Android App, and i need to put a control that let user choose between 4 different colors. I wan开发者_如何学JAVAt to do this with something like radio buttons: the problem is that radio

I'm making an Android App, and i need to put a control that let user choose between 4 different colors. I wan开发者_如何学JAVAt to do this with something like radio buttons: the problem is that radiobuttons are round...

is there a way to set them looks like square/rect buttons, and assign a color to their inside rect area ?

If not, how can i achieve that choose for the user ?

I need this because i'm making a Todo/Task android application, and i need the user to choose the priority of a task, between for priority level that are rapresented with a color. So i think to do that by showing 4 buttons, each with a different color associated, and a text inside ("0", "1", "2", "3")

Thanks!


is there a way to set them looks like square/rect buttons, and assign a color to their inside rect area ?

Step #1: Copy $ANDROID_HOME/platforms/$API/data/res/drawable/btn_radio.xml to your project, where $ANDROID_HOME is where you have installed the Android SDK and $API is some Android platform (e.g., android-2.1)

Step #2: Copy $ANDROID_HOME/platforms/$API/data/res/drawable-hdpi/btn_radio* to your project

Step #3: Copy $ANDROID_HOME/platforms/$API/data/res/drawable-mdpi/btn_radio* to your project

Step #4: Modify those PNG files from steps #2 and #3 to suit your needs

0

精彩评论

暂无评论...
验证码 换一张
取 消