I created a custom View (find it here) with an declare-styleable attribute of type enum. In xml I can now choose one of the enum entries for my custom attribute. Now I want
It's simple let's show everybody an example just to show how easy it is:
attr.xml:
Custom layout:
public enum Direction {RIGHT_TO_LEFT, LEFT_TO_RIGHT, TOP_TO_BOTTOM, BOTTOM_TO_TOP}
Direction direction;
...
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.MyMotionLayout);
Direction direction = Direction.values()[ta.getInt(R.styleable.MyMotionLayout_motionOrientation,0)];
now use direction like any other enumeration variable.