【问题标题】:not allowed to add android:windowTranslucentStatusbar to style file不允许将 android:windowTranslucentStatusbar 添加到样式文件
【发布时间】:2014-01-05 14:16:24
【问题描述】:

添加后我无法编译我的项目 项目名称="android:windowTranslucentStatus" 到我的主题中,只需将其添加到我的主题中就会出现错误,告诉我我需要以 SDK 版本 19 为目标。

这完全没问题,但是如果我将样式移动到我的 values-v19 文件夹,我会收到一条错误消息,提示可以找到 android:windowTranslucentStatus。

我对 android 没有那么丰富的经验,但这不是正确的做法吗?

values/styles.xml error:
android:windowTranslucentStatus requires API level 19 (current min 14)  


values-v19/styles.xml error
Error: No resource found that matches the given name: attr 'android:windowTranslucentStatus'.

如果重要的话,我的主题的父主题是 android:Theme.Holo.Light。

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    所以我解决了我的问题,问题不在于代码本身,显然我将模块 SDK(在项目设置 > 模块 > 依赖项 > 我在 Android Studio 中的项目中)设置为 API 18。

    将其更改为 API 19 解决了所有问题。

    【讨论】:

      【解决方案2】:

      到目前为止,我担心这个主题应该在你的 androidMenifest 文件中完成。在每个活动下,您可以定义主题,或者如果每个活动共享相同的主题,那么在应用程序标签下添加它应该没问题。但是下面是代码,这就是我完成工作的方式。

       <application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
          <activity
              android:name="com.aminoit.blogspot.notifyme.MainActivity"
              android:label="@string/app_name" >
              <intent-filter>
                  <action android:name="android.intent.action.MAIN" />
      
                  <category android:name="android.intent.category.LAUNCHER" />
              </intent-filter>
          </activity>
      </application>
      

      【讨论】:

      • 你看到 android:teme="@android:style/Theme.Translucent.NoTitleBar.FullScreen" 了吗?这就是我的主题。但是,参考基本主题,您可以根据需要对其进行自定义!
      • 我实际上是在使用我的自定义主题关注这个stackoverflow.com/questions/20167755/…
      • 那么,您应该通过转到 项目构建属性 更改目标 sdk 来进行此更正,但是硬编码可能无济于事。在你做任何其他事情之前,只做一件事。创建一个新项目并将 tartget Sdk Versioin 设置为 17。然后对新项目进行自定义。这应该可以解决您的问题 Insha-Allah。 :)
      • 是的,我明白了,但是你不使用操作栏是吗?
      猜你喜欢
      • 1970-01-01
      • 2022-12-13
      • 2023-03-15
      • 2023-03-25
      • 2012-01-04
      • 2021-09-29
      • 1970-01-01
      • 2021-04-22
      • 1970-01-01
      相关资源
      最近更新 更多