形状没有显示

时间:2011-07-13 02:17:14

标签: android android-layout

形状背景=“@ 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>

==&GT; profile_rounded_top_shape.xml&lt; ==

<?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>

==&GT; profile_rounded_top.xml&lt; ==

<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> 

==&GT; profile_rounded_top_pressed.xml&lt; ==

<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 个答案:

答案 0 :(得分:3)

background="@drawable/profile_rounded_top_shape"

前面应该有android命名空间:

android:background="@drawable/profile_rounded_top_shape"