简体   繁体   中英

@drawable vs @android:drawable in android

Is there any difference between

android:src="@andriod:drawable/filename"

and

android:src="@drawable/filename"

I can access the same resource in this way in xml file. What's the difference?

There's a whole lot of difference:

android:src="@android:drawable/filename"

It allows you to only access those drawables which are provided by the android package, and:

android:src="@drawable/filename"

allows you to access those drawables that you put inside your app's drawable folder

The difference between both calls is simple

android:src="@andriod:drawable/filename" 

This gives access to in-built drawable files in your android sdk.

and

android:src="@drawable/filename"

This gives access to in drawable files which are used for project ie, drawable in res folder of project folder in your android sdk.

While using the First one we can find out that it will not show the names of any drawable in res folder of project. And when you use second one it will not show names of in built drawable

You can find all in-built resources (drawable,animations etc) used by your API level in SDK

<your_path>\sdk\platforms\<api-level>\data\res

eg <your_path>\\sdk\\platforms\\android-19\\data\\res this will show all in-built resource under API-19

yes both are very different.

android:src="@andriod:drawable/filename" this is a resource where u can get the android inbuilt resources.

android:src="@drawable/filename" this is the resource where you add ur own resources and access.

The notation is

@[package:]drawable/filename

The resources you access with your first line are drawables embedded in the android project. If you don't define the package you access the resources from the res folder in your app. Those are not the same resources.

Yes , of course. There is difference between"@andriod:drawable/filename" & @drawable/filename.

"@android:drawable/filename"

is provided by the system .The resources are contained in your SDK.you can explore the path of resource to check.

"@drawable/filename"

is our own resources , like app's icon , background & more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM