机器人 - 需要layout_attribute缺少

问题描述:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 
    <gradient 
     android:layout_width="match_parent" 
     android:angle="270" 
     android:centerColor="#4ccbff" 
     android:endColor="#24b2eb" 
     android:startColor="#24b2eb" /> 
<corners android:radius="5dp" /> 
</shape> 

上面的代码显示就行“需要layout_height属性丢失”无机器人 - 需要layout_attribute缺少

&

“需要layout_heightlayout_width属性丢失”上线号。

+0

它应该告诉你哪个属性丢失。在第一种情况下看起来是layout_height,在第二种情况下看起来是layout_height和layout_width – 2013-04-26 06:12:18

+0

是的,在第二种情况下,它在两种布局上都显示错误。 我在代码中包含了android:layout_height =“wrap_content”,但它显示了相同的错误。 – 2013-04-26 06:17:28

+0

其layout_height,而不是高度。 – 2013-04-26 06:18:37

我的意见是从形状,渐变和角落中删除任何布局信息。 您的文件应该如下所示。

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <gradient 
     android:angle="270" 
     android:centerColor="#4ccbff" 
     android:endColor="#24b2eb" 
     android:startColor="#24b2eb" /> 
    <corners android:radius="5dp" /> 
</shape> 
+0

这是工作! 谢谢:) – 2013-04-26 06:35:53

+0

@YuvaRaj快乐的帮助! – 2013-04-26 06:38:37

+0

是的,形状没有布局。 – Ridcully 2013-04-26 06:46:52