If you want to have access to these "android" attributes, you can "override" them: in the declaration of the declared style, for example.
<attr name="android:padding"/>
Then you can easily get it this way:
int padding = a.getInt(R.styleable.CustomView_android_padding, -1);
For recording only, anwser is inspired by the source code for the TwoWayView layout, implemented by Lucas Rocha. I think this is a good example for analyzing how to implement custom views.
source share