How can I set following activity style attribute programmatically
<item name="android:windowIsFloating">true</item>
One possible solution is to create a new style with only the windowIsFloating
attribute set. Then, overwrite the getTheme
method on your targeted activity in order to set that style. (Assuming AppTheme.NoActionBar
is you current style).
styles.xml
<style name="MyCustomStyle" parent="AppTheme.NoActionBar">
<item name="android:windowIsFloating">true</item>
</style>
TargetActivity.java
@Override
public Resources.Theme getTheme() {
Resources.Theme theme = super.getTheme()
theme.applyStyle(R.style. MyCustomStyle, true)
return theme
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With