Jeet
Jeet

Reputation: 781

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

Upvotes: 4

Views: 2637

Answers (5)

Don Chakkappan
Don Chakkappan

Reputation: 7560

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.

Upvotes: 1

edwin
edwin

Reputation: 8081

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

Upvotes: 2

Dominic
Dominic

Reputation: 3473

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.

Upvotes: 1

M S Gadag
M S Gadag

Reputation: 2057

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.

Upvotes: 1

Sarthak Mittal
Sarthak Mittal

Reputation: 6104

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

Upvotes: 10

Related Questions