Joe Joe - 2 months ago 18
Android Question

Android Layout match_width

is there anyway in Android to set the height of the LinearLayout to match it's width?

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="MATCH_WIDTH_OF_THIS_LinearLayout"


I have the LinearLayout to match_parent's width, and I want this LinearLayout to match it's own width for it's height.

Answer

Yes there is, by using

android:adjustViewBounds(true);
Comments