I have a LinearLayout containing an ImageView with fixed height, and a TextView with wrap_content height. I want the LinearLayout to grow to fit the entire TextView if the text doesn't fit on one line.
My code:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:scaleType="fitCenter"
android:src="@drawable/question_mark"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:singleLine="false"
android:text="Some long text that doesnt fit on one line"/>
</LinearLayout>
The LinearLayout in the example above doesn't resize, so I only see "Some long text" and then the rest of the TextView is hidden.
Any way to get the LinearLayout to resize according to the TextView?
I know I can use RelativeLayout and other types of layouts to achieve this, but I'm asking about a solution using LinearLayout.
