var attrs = Android.App.Application.Context.ObtainStyledAttributes(Resource.Styleable.MyTheme); var colorValue = attrs.GetAttributeResourceValue(Resource.Styleable.MyTheme_myAttribute, 0);
var attrs = context.ObtainStyledAttributes(Resource.Styleable.MyView); var drawableId = attrs.GetAttributeResourceValue(Resource.Styleable.MyView_myDrawableAttr, -1); var drawable = ContextCompat.GetDrawable(context, drawableId);This code snippet retrieves the resource ID of the `myDrawableAttr` attribute defined in a custom view `MyView`, and then uses it to retrieve the drawable resource. Package library: Xamarin.Android.