android - ButtonView with different background -
i have designed rounded corners button.
button_selector.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="10dp"/> </shape>
in layout:
<button android:background="@drawable/button_selector" .../>
on every click color of should button changes :
in activity, inside onclicklistener():
btn1.setbackgroundcolor(getanswercolor(choicearray[0]));
but if this, not getting rounder corners.
how rounder corners? please suggest.
btn1.setbackgroundresource(r.drawable.button_selector); gradientdrawable drawablegradient = (gradientdrawable) btn1.getbackground(); drawablegradient .setcolor(color.red);
Comments
Post a Comment