Android : How to change programmatically background of custom style android

on Thursday, March 26, 2015


Hi I have custom Style in XML which work fine and there is no issue with that, but I want to change background programmatically as my requirement



<style name="Widget.Holo.SegmentedControl" parent="@android:style/Widget.CompoundButton.RadioButton">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">45dp</item>
<item name="android:minHeight">@dimen/segmented_control_default_height</item>
<item name="android:textSize">16dp</item>
<item name="android:textStyle">bold</item>
<item name="android:stretchColumns">0</item>

<item name="android:gravity">center</item>
<item name="android:background">@drawable/segmented_control_background</item>
<item name="android:button">@null</item>
<item name="android:textColor">@color/segmented_control_text</item>

<item name="lineColor">@null</item>
<item name="lineHeightUnselected">0dp</item>
<item name="lineHeightSelected">0dp</item>
</style>


In my custom style I want to change background, which is another drawable item Is there any way to change background and then set to mine view programmatically


Currently setting the style through xml



<RadioGroup
android:id="@+id/buttongroup_meetings"
style="@style/Widget.Holo.SegmentedControl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >


</RadioGroup>


Thanks


0 comments:

Post a Comment