Maybe I am doing something wrong, but the new layout editor is not
picking up my custom styleable attributes.
I have:
<declare-styleable name="ColorPicker">
<attr name="style">
<enum name="horizontal" value="0"/>
<enum name="circular" value="1"/>
</attr>
<attr name="arrowColor" format="color"/>
</declare-styleable>
The custom View constructor:
TypedArray attributes = context.obtainStyledAttributes(attrs,
R.styleable.ColorPicker);
setStyle(Style.values()
[attributes.getInt(R.styleable.ColorPicker_style,
Style.HORIZONTAL.ordinal())]);
setArrowColor(attributes.getColor(R.styleable.ColorPicker_arrowColor,
Color.WHITE));
Layout:
<LinearLayout ... xmlns:app="http://schemas.android.com/apk/res/
com.blah.myapp" ...>
<com.blah.myapp.widget.ColorPicker android:id="@+id/color"
android:layout_width="match_parent"
android:layout_height="50dp"
app:style="circular"/>
The control is fine at runtime, but at layout design time, it's shown
with it's default style "HORIZONTAL". Also, the property pane says
"app:style" is an "Unknown XML attribute"
Is this supposed to work at all? Is it a bug or am I doing something
wrong on my end?
Created issue 17397 for this on b.android.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en