gpt4 book ai didi

xml - 使用 XML 为 Android 显示自定义标题栏

转载 作者:行者123 更新时间:2023-11-29 22:34:08 26 4
gpt4 key购买 nike

在描述“Configuring General Window Properties”的 Android 文档中,建议尽可能通过 XML 指定属性,以避免看到标题栏闪烁。例如,他们没有使用 requestWindowFeature 设置 Window.FEATURE_NO_TITLE,而是将其设置为 @android:style/Theme.NoTitleBar。是否有类似的方法来设置要在 XML 中使用的自定义标题栏?

最佳答案

完整的可用 XML 属性集记录在 R.styleable 中.自定义标题似乎没有任何 Window 属性,因此 FEATURE_CUSTOM_TITLE 只能在代码中设置。

根据 this article ,绘制标题栏的最佳方法是忽略 FEATURE_CUSTOM_TITLE,而只是将标题栏绘制为主视图的一部分。这不仅可以避免闪烁,还可以 problems caused by padding .

关于xml - 使用 XML 为 Android 显示自定义标题栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2726190/

26 4 0