P
P
Prototik2012-02-21 13:00:53
Android
Prototik, 2012-02-21 13:00:53

Custom view size calculation?

There is actually a custom view, if you specify the exact dimensions or fill_parent for both properties (layout_width and layout_height) on layout-e, everything is OK, but if you specify wrap_content, the view is flattened to 0. Actually, as I understand it, you just need to rewrite a couple of methods for calculate the width-height, but where exactly, kick in the right direction.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
LeoCcoder, 2012-02-21
@Prototik

developer.android.com/guide/topics/ui/custom-components.html
onMeasure() should be overridden to efficiently and accurately report the measurements of its contained parts

S
serso, 2012-02-21
@serso

Since you are asking such questions, you need to start from here: Android User Interface . Then ViewGroup.LayoutParams I'll
warn you right away - calculating the width / height by hand is the wrong way to work with the GUI.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question