I created a custom view.
I want to get values of "background","layout_width" and
"layout_height" in its constructor "CustomView(Context context,
AttributeSet attrs)".
I wrote code like this:
TypedArray b = context.obtainStyledAttributes(attrs, new
int[]
{android.R.attr.background,android.R.attr.layout_width,android.R.attr.layout_height});
bgColor = b.getColor(0, bgColor);
width=b.getDimensionPixelOffset(1, 300);
height=b.getDimensionPixelOffset(2, 100);
It works in Emulator. I can get the right values. But when editing it
in layout editor, it can't get the right values I set. It only draws
using the default values. So it is very different in layout editor
and emulator. I don't know if I get these values in incorrect way or
if the layout editor has some bugs.
Any tips?
--
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