What is the different between the foler "drawable" and the file
"drawable.xml"?
In the activity_main.xml, there are two rows code
android:background="@drawable/border_ui" and
android:background="@drawable/my",
but the one use the border_ui.xml located the folder res\drawable, and the
other use the file drawable.xml located the folder res\values.
What different? Thanks!
And more, an error will occur if I remove the file drawable.xml to the
folder res\drawable and rename it as my.xml.
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:background="@drawable/border_ui"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:background="@drawable/my"
/>
</RelativeLayout>
border_ui.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke android:width="1dp" android:color="#000000" />
<solid android:color="#ffffff" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
</shape>
drawable.xml
<resources>
<drawable name="my">#f00</drawable>
</resources>
No comments:
Post a Comment