gpt4 book ai didi

java - 设置安卓 :windowIsFloating programmatically

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:45:09 35 4
gpt4 key购买 nike

如何以编程方式设置以下 Activity 样式属性

          <item name="android:windowIsFloating">true</item>

最佳答案

一个可能的解决方案是创建一个仅设置了 windowIsFloating 属性的新样式。然后,覆盖目标 Activity 的 getTheme 方法以设置该样式。 (假设 AppTheme.NoActionBar 是您当前的风格)。

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
}

关于java - 设置安卓 :windowIsFloating programmatically,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18802041/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com