【发布时间】:2013-11-24 18:06:27
【问题描述】:
我有 Scrollview、Layout 和 TextView。
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Layout"
android:orientation="vertical"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_gravity="left|center_vertical"/>
</LinearLayout>
</ScrollView>
如何根据文本长度设置高度布局?如果文本很短,布局高度应该等于屏幕高度。但是当文本很长(例如超过 100 句)时,布局高度应该大于屏幕高度,并且应该取决于文本的长度。
【问题讨论】:
标签: android android-layout height