2011-07-13 80 views
1

形狀背景=「@ drawable/profile_rounded_top_shape」不是繪圖,我在想什麼?形狀不顯示

<LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      background="@drawable/profile_rounded_top_shape" 
      android:clickable="true"> 
      <TextView 
       android:id="@+id/textView1" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="TextView"/> 
     </LinearLayout> 

==> profile_rounded_top_shape.xml < ==

<?xml version="1.0" encoding="utf-8"?> 

    <selector 
     xmlns:android="http://schemas.android.com/apk/res/android"> 
     <item 
      android:state_pressed="true" 
      android:drawable="@drawable/profile_rounded_top_pressed" /> <!-- pressed --> 
     <item 
      android:drawable="@drawable/profile_rounded_top" /> <!-- default --> 
    </selector> 

==> profile_rounded_top.xml < ==

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <solid android:color="#FFFFFF" /> 
    <stroke 
     android:width="3dp" 
     android:color="#FF000000" /> 
    <corners 
     android:topLeftRadius="10dp" 
     android:topRightRadius="10dp" /> 
</shape> 

==> profile_rounded_top_pressed.xml < ==

<shape 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <solid 
     android:color="#FFFFFF" /> 
    <stroke 
     android:width="3dp" 
     android:color="#FF000000" /> 
    <corners 
     android:topLeftRadius="10dp" 
     android:topRightRadius="10dp" /> 
    <gradient 
     android:startColor="#6633cc" 
     android:endColor="#00ccff" 
     android:angle="270" /> 
</shape> 
+1

命名空間? '背景' - >'android:背景' –

+0

天才。提交積分答案 – hunterp

回答

3
background="@drawable/profile_rounded_top_shape" 

應該在它前面的android命名空間:

android:background="@drawable/profile_rounded_top_shape"