2013-04-26 100 views
0
<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

回答

1

我的意見是從形狀,漸變和角落中刪除任何佈局信息。 您的文件應該如下所示。

<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