Хорошо, мне просто удалось это сделать.
when you obtain the value of your style attribute, it give you in this case the value of ?attr/layoutElementStyle. But since this is itself a style, the correct way to do it is:
int style = attrs.getStyleAttribute();
TypedArray a = context.obtainStyledAttributes(style, R.styleable.Style_lib);
int elementStyleId = a.getResourceId(R.styleable.Style_lib_layoutElementStyle, -1);
a.recycle();
and then just do it as usual way;
context.obtainStyledAttributes(elementStyleId , R.stylable.CustomView);
and so.
Итак, с атрибутом стиля вам просто нужно сначала получить текущий стиль, а затем получить доступ к атрибуту.
Если кто-то как еще один опыт, я ценю некоторые отзывы об этом.
Спасибо.