Menachem Hornbacher
Menachem Hornbacher

Reputation: 2165

How to make a selector in Android Studio

While taking a course, I was instructed to make an xml selector for a Button. The course said to make a new Android xml in Eclipse, but i am using Android Studio.

Also when I custom write the code it gives me an error. It says "element selector must be declared".

as you can see selector is an error

Got code from here: Android: How to Make A Drawable Selector.

Does anyone know how to do this in Android Studio?

Upvotes: 22

Views: 38568

Answers (2)

3h3
3h3

Reputation: 722

First of all, there will be no drawable folder when establish a new Android Project in Android Studio likes Eclipse does. Right click on res folder--> New--> Android Resource Directory--> resource type--> drawable, and now you get a drawable folder, and then, you can add your new drawable resource file, selector, shape and .etc

Upvotes: 4

Dev Gurung
Dev Gurung

Reputation: 1288

Though it is already answered in the comment, enter image description here

Upvotes: 37

Related Questions