TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AppTheme, 0, 0); int textColor = a.getColor(R.styleable.AppTheme_textColor, 0); float textSize = a.getDimension(R.styleable.AppTheme_textSize, 0);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomView, 0, 0); int imageResId = a.getResourceId(R.styleable.CustomView_image, 0); boolean showTitle = a.getBoolean(R.styleable.CustomView_showTitle, false);In this example, we are retrieving the values for the image and showTitle attributes defined in the CustomView style. These values are from the R.styleable.CustomView resource file, which is part of a custom library. In conclusion, the package library can be determined by looking at the resource file that is used to retrieve the values. If the resource file is from the Android framework library, then the package library is android.content.res. If the resource file is from a custom library, then the package library will be the package name of the library.