Found by me:
View v = findViewById(R.id.layout_id);
LayerDrawable bgDrawable = (LayerDrawable)v.getBackground();
final GradientDrawable shape = (GradientDrawable) bgDrawable.findDrawableByLayerId(R.id.shape_id);
shape.setColor(----);
More Related Contents:
- Android Drawable: Specifying shape width in percent in the XML file?
- How to support all the different resolutions of android products
- Half circle shape not work
- Android layout with one side round [closed]
- How can I dynamically set the position of view in Android?
- Get the URI of an image stored in drawable
- Resizing layouts programmatically (as animation)
- Why this line xmlns:android=”http://schemas.android.com/apk/res/android” must be the first in the layout xml file?
- How to show android checkbox at right side?
- Drawable folders in res folder?
- Android: can height of SlidingDrawer be set with wrap_content?
- Android: Last line of textview cut off
- Android: xml layout for a listview with different items
- Android Dashboard Pattern
- Android: Cloning a drawable in order to make a StateListDrawable with filters
- Android Custom Layout – onDraw() never gets called
- Newer versions of Android Studio and only two drawable directory – drawable and drawable-v21
- Android layout with square buttons
- Stackoverflow: Caused by nested views?
- change order of views in linear layout android
- Not enough space to show ad (AdMob)
- How can I write a Drawable resource to a File?
- Using drawable resources
- Rounded corner for textview in android
- How to create a view that is bigger than the screen?
- How to expand a layout height with animation?
- How to create fixed footer in android layout?
- Styling EditText view with shape drawable to look similar to new holographic theme for Android < 3.0
- How to set foreground attribute to other non FrameLayout view
- Custom PopupMenu (layout)