gpt4 book ai didi

android - 为什么在使用操作栏的支持库 API 时每个样式属性必须声明两次?

转载 作者:太空狗 更新时间:2023-10-29 15:04:02 25 4
gpt4 key购买 nike

我正在使用 v7 支持库,以便在 API 级别 10+ 上拥有一个 ActionBar。我想稍微自定义一下外观。所以我添加了一个应用程序主题。

但是 google docs说:

Please Note: when overriding attributes for an ActionBar style you must specify each attribute twice: once with the "android:" namespace prefix and once without.

each style property that you declare must be declared twice: once using the platform's style >properties (the android: properties) and once using the style properties included in the Support >Library (the appcompat.R.attr properties—the context for these properties is actually your app).

为什么我们需要对每个样式属性声明两次?或者“android:”前缀如何工作?

最佳答案

我想这是合理的,因为这个“android:”前缀意味着从系统获取属性,如果它失败,系统可以通过另一个没有前缀的声明获取属性。这是一个让你的应用程序既能 catch 最新的andorid风格又能很好兼容的好方法

关于android - 为什么在使用操作栏的支持库 API 时每个样式属性必须声明两次?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23604824/

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