Ωmega
Ωmega

Reputation: 43673

List of all Android system resources dimen attributes

Since the most of the Android system resources attributes are not public, identifiers and its attributes have to be accessed via getIdentifier as follows (example):

public static int getStatusBarHeight(Context context) {
    int result = 0;
    int resourceId = context.getResources()
            .getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result = context.getResources().getDimensionPixelSize(resourceId);
    }
    return result;
}

Where can I see the list of all the identifier that can be accessed by this method?

Upvotes: 1

Views: 222

Answers (1)

Droidman
Droidman

Reputation: 11608

You can find the dimens definitions in the source code of the Android Open Source Project on GitHub.

Note: the list may (and most likely will) be slightly different with each release - select the branch that corresponds to the Android version you are interested in.

If you are looking for the possible defType values when trying to access an identifier my guess is that those are platform-standard resource types, such as bool, integer etc. See here and here.

Here's a link to Android's default resources from the current master branch.

Upvotes: 1

Related Questions