I am adding attributeset to a custom component like this:
<declare-styleable name="MySeekBarWidget">
<attr name="type">
<enum name="money" value="1" />
<enum name="percent" value="2" />
<enum name="time" value="3" />
<enum name="money_frequency" value="4" />
<enum name="money_percent_or_fixed" value="5" />
<enum name="money_month" value="6" />
<enum name="time_year_only" value="7" />
</attr>
</declare-styleable>
I can get the value of each enum by asking it from the typed array:
public MySeekBarWidgetLayout(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.MySpinnerContainer);
type = array.getInt(R.styleable.MySeekBarWidget_type,1);
array.recycle();
}
But what if I wanted the actual name of the enum, not the value. How would I get that in code? Please help
No comments:
Post a Comment