Hi,
I'm new to android programming. I'm trying to change a item inside a
layerlist when the user press a button. The problem is that when the
button is clicked, the drawable disapears. If I finish the intend and
start it again, the drawable apears updated. Can someone see what I'm
doing wrong?
The XML code for the layerlist is:
<layer-list android:id="@+id/avatar_image" xmlns:android="http://
schemas.android.com/apk/res/android" >
<item
android:id="@+id/bg_layer"
android:drawable="@drawable/background01" />
<item
android:id="@+id/skin_layer"
android:drawable="@drawable/skin01" />
<item
android:id="@+id/face_layer"
android:drawable="@drawable/face01" />
(...)
In the XML Code for the window I have:
<ImageView
android:id="@+id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/avatar_image"
android:layout_centerHorizontal="true"
/>
So for the OnClickListener I have:
bgButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
layerList.setDrawableByLayerId(R.id.bg_layer,
res.getDrawable(R.drawable.background02));
layerList.invalidateSelf();
}
});
Feel free to share your answer here:
http://stackoverflow.com/questions/6091933/changing-layer-list-drawables
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en