Robby Smet
Robby Smet

Reputation: 4661

Use keyboard drawables

I'm working on a layout that looks like a numeric keyboard.

I was looking around in my folder:

C:\Program Files\Android\platforms\android-8\data\res\drawable-mdpi

And I found some drawables like sym_keyboard_feedback_ok or sym_keyboard_num(1-9) that I could use :)

enter image description here

But when I type

android.R.drawable.

There are no drawables that start with sym_keyboard..

How can I access those drawables without copying them manually to my resource folder ?

Upvotes: 0

Views: 1111

Answers (1)

Amir
Amir

Reputation: 203

Well, I was looking for the same thing but then I realized that all R.drawables are not accessible. If you look at the android.R.drawable reference you will not found those items that you are looking for. Also this sample shows all accessible drawables in a list which might be useful.

In the given sample, there is a for loop, if you change the loop's interval in the following way you might found those items (in my case, I see drawables that start with sym_keyboard):

for (int idx = 17301504; idx <= 17303380; idx++) {
        data = new HashMap<String, Object>();
        try {
            String stg = Resources.getSystem().getResourceName(idx);
            data.put("line1", stg);
            data.put("line2", idx);
            data.put("img", idx);
            resourceNames.add(data);
        }
        catch (Resources.NotFoundException nfe) {
        }
    }

At the end, this approach is not suggested because the drawable references might be different in different APIs so I was forced to copy my favorite drawables to the project and use them as regular drawables.

Drawables on HTC Sensation with ics 4.0

Upvotes: 1

Related Questions