【问题标题】:Error:(12, 21) String types not allowed (at 'android:layout_height' with value ''). with 3dp错误:(12, 21) 不允许使用字符串类型(在 'android:layout_height' 处,值为 '')。带 3dp
【发布时间】:2015-04-11 06:26:46
【问题描述】:

我将<item name="android:layout_height">3dp</item> 定义为我的自定义样式中的一个项目。 但我收到以下错误消息:

错误:(12, 21) 不允许使用字符串类型(在 'android:layout_height' 处,值为 '')。 错误:任务“:app:processDebugResources”执行失败。 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/home/juude/prog/android-sdk-linux/build-tools/22.0.1/aapt''以非零退出值 1 结束

我认为这可能是android studio的问题,因为我在以前的版本中没有遇到这个问题。从那以后我没有改变这种风格。 但我不明白为什么。

【问题讨论】:

    标签: android android-gradle-plugin aapt


    【解决方案1】:

    我找到了解决方案,您不能在样式定义中定义大于 0 的尺寸。相反,我将尺寸定义为 <dimen name="the_height">50dp</dimen> 然后做一个参考 <item name="android:layout_height">@dimen/the_height</item>

    【讨论】:

      猜你喜欢
      • 2017-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 1970-01-01
      • 2016-08-06
      • 1970-01-01
      相关资源
      最近更新 更多