i can set a style like this
ImageView
android:id="@+id/blah"
style="@style/mystyle"
/>
But Is there a way to set a style for a View at runtime? Like
ImageView iv = (ImageView)findViewById(...);
iv.setStyle(R.style.myotherstyle);
There is no
setStyle()
method because you can't change the style after the view is
initialized.
Check this : Where is the View.setStyle() method?
No, unfortunately there is no way to change a style at runtime. Your best bet is to set the individual attributes (padding/margins/width/etc) one at a time at runtime.