The calculation of the size of custom view?

There are actually custom view, if his layout-e to specify the exact dimensions or fill_parent for both properties (layout_width and layout_height), everything is OK, but if you specify wrap content — view flattened to 0. Actually, as I understand it, you just have to rewrite a couple of methods to calculate the width-height of the kick in the right direction.
October 8th 19 at 03:09
2 answers
October 8th 19 at 03:11
Solution
developer.android.com/guide/topics/ui/custom-components.html

onMeasure() should be overridden to efficiently and accurately report the measurements of its contained parts
Thank you - cecilia_Zemlak commented on October 8th 19 at 03:14
to be told more what kind of view you come up with... maybe there's an easier way... - Houston commented on October 8th 19 at 03:17
So Yes, like imageview with fintifluhka. Reader 4pda do current Shhh:) - cecilia_Zemlak commented on October 8th 19 at 03:20
there is an article, a little help perhaps )

onMeasure rarely have to override, so ask... maybe you do something not optimal... but if it's a secret... good luck ) - Houston commented on October 8th 19 at 03:23
October 8th 19 at 03:13
Since asking these questions, then you should start here: Android User Interface. Then The ViewGroup.LayoutParams

Immediately warn — calculate width/height of the hands is the wrong way to work with GUI.
Yeah, the Android we have now also a telepath, he will guess how much space to allocate on the screen with a unique custom look. which man invented =)))) - cecilia_Zemlak commented on October 8th 19 at 03:16
What is the question — is the answer =) If your custom View extends TextView, it is likely that you can rely on the rendering implemented in the SDK. Again — it all depends on the objectives (goals) that the Asker did not mention. - Houston commented on October 8th 19 at 03:19

Find more questions by tags Android