79594629

Date: 2025-04-27 03:16:15
Score: 0.5
Natty:
Report link

Are you trying to randomly change the color of a specific layer inside a LayerDrawable? If so, you can find the target drawable within the LayerDrawable either by index (getDrawable(int index)) or by ID (findDrawableByLayerId(int id)), and then change its color using setTint(int tintColor). If your LayerDrawable is created in XML, you can directly assign an ID to each layer like this:

<item
    android:id="@+id/background_layer"
    android:drawable="@drawable/bottom_background_drawable" />
Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: wangpan