I have a view where I defined sizes using dip.
I want to include this in other layouts in different sizes. I thought setting the size in the include tag
<include
android:id="@+id/abc"
android:layout_width="100dip"
android:layout_height="100dip"
layout="@layout/myInclude"
/>
would make that my included layout is resized proportionally but it doesn’t. So everything I defined using dip in the included layout appears with the same size and breaks the layout.
Is this expected behaviour and what can I do to solve this?
A possible solution in to use LinearLayout with weights in the included layout, instead of hardcode in dip. But with dip I have more control, and don’t have to use LinearLayouts everywhere…
Thanks in advance.
If you specify a size in dip or any other fixed unit, it won’t resize automatically. That would be weird, generally when you hardcode a size you don’t want your view to be resized.
Layout weights (and LinearLayouts) are the only way to go.