Skip to content Skip to sidebar Skip to footer

Checkbox Background Issue In Android + Xperia X10

I am trying to set backgroundColor of CheckBox by code. Its not working on xperia series. same code has tested other deices which is working on samsung and motorola. CheckBox chec

Solution 1:

There may be some issue with xperia to setBackgroundColor(). but it works with setDrawingCacheBackgroundColor();

CheckBoxcheckBox= (CheckBox) findViewById(R.id.checkbox);
checkBox.setDrawingCacheEnabled(true);
checkBox.setDrawingCacheBackgroundColor(Color.RED);

Solution 2:

Try:

checkBox.setBackgroundColor(getContext().getResources().getColor(R.color.red));

If this doesn`t work then setBackgroundColor is broken for Xperia x10

Solution 3:

it has this issue on xperia series ,you can declare the defalut value in layout.xml file,i set the background image ok , android:background="@drawable/test" , then set "setBackgroundResource" int the code, first of all set the default value in the layout.xml

why the last answer be deleted when i answer by chinease ? :(

Post a Comment for "Checkbox Background Issue In Android + Xperia X10"