是否可以告诉一个视图,它至少应该包装它的内容,但是如果父视图留下空间来拉伸,那么它应该填充它的父视图?
例子:
我想要的是,容器线性布局环绕它的内容......如果我的标题文本视图比滚动视图宽,它不会被剪切!如果我将标题 textview 设置为 wrap_content,如果滚动视图比标题宽,它不会填充它的父级...
 <LinearLayout
                android:id="@+id/llWeightsParent"
                style="@style/group"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:clickable="true"
                android:onClick="onClick"
                android:orientation="vertical" >
                <TextView
                    android:id="@+id/tvWeight"
                    style="@style/text_group_title"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="1dp"
                    android:text="@string/weight" />
                <ScrollView
                    android:id="@+id/svWeights"
                    android:layout_width="wrap_content"
                    android:layout_height="fill_parent" >
                    <LinearLayout
                        android:id="@+id/llWeights"
                        style="@style/group_content"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical" >
                    </LinearLayout>
                </ScrollView>
            </LinearLayout>