0

I have a class inherited from android's ImageView.

The problem is to get a layout-parameter, for example, "layout_marginLeft" in constructor as it is defined in XML. Or, in overrided onFinishInflate(). Second way is fail because this.getLayoutParams returns null in onFinishInflate(), so it looks like completely impossible.

But how to get it from AttributeSet in constructor? attrSet.getAttributeIntValue("android", "layout_marginLeft", -100500); always returns -100500, but this parameter exists in list of attribute names. If I replace "android" to empty string "", there is no difference. Anyway, android docs don't explain what the hell is "namespace". It tells it is just a mystic namespace and no comments :(

Alexander Taran
  • 976
  • 3
  • 12
  • 25

0 Answers0