android - Setting a StateListDrawable as ImageButton/ImageView.backgroundDrawable in a widget based on users choice in the configuration activity -


i'm creating widget user in configuration activity can select variety of graphics used in button (imageview (or imagebutton) with statelistdrawable). selected graphic used in widget layout when widget added. layout follows:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"      android:orientation="vertical"      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:layout_gravity="center">      <imageview         android:id="@+id/button"          android:layout_width="72dip"          android:layout_height="72dip"         android:background="@null"          android:clickable="true">     </imageview> </linearlayout> 

my question is, how set selected backgroundresource in imagebutton shown in widget based on users choice in configuration activity?

i'll answer own question here. seems it's not possible set statelistdrawable in remoteviews via code. solution me use xml-layouts has references unique selectors (i made generator, generate them easily). tedious when working large number of graphic elements, seems option.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -