First of all, related questions to my topic:
How do I access layout_height from within my custom view?
How do you get "android:" tag values in a Custom View.
So I have the result in a String
which is ok, but the question is: is there a way to somehow automatically parse the String
result that I get back from attrs.getAttributeValue()
or is there a solution to get it somehow in an already parsed format ( = get the value in pixels)? Like when you call getDimensionPixelSize()
.
Because the returned String
can have values like ?2130772036
(reference), -2
(wrap_content), 122.0dip
(or in the worst case 122px
, 122mm
, etc...).
And I don't want to add layout_height
to my custom attrs.xml
if not necessary.