我正在使用以下XML布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!--Multi Line TextView -->
<TextView
android:id="@+id/incomingmsg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:inputType="textMultiLine"
android:minLines="5"
android:scrollbars="vertical"
android:singleLine="false"
android:textIsSelectable="true" >
</TextView>
<!--Some more Views Here -->
</LinearLayout>
如果TextView
包含太多数据,则下面的View
不会出现在屏幕上。我希望根据文本的大小将View
显示在TextView
的正下方。
使用 RelativeLayout :
// scrollview is to scroll the layout even the Textview takes the full height of the device so that the view is visible under TextView.
//If your Textview doesn't take too much height, you don't need to use scrollview.
<Scrollview>
<RelativeLayout>
<TextView>
<View
android:layout_width="match_parent"
android:layout_height="4dip"
android:layout_below="@id/textview"
android:background="#7c7c7c" />
</RelativeLayout>
<Scrollview>
根据您的 XML,您的视图设置为在文本视图(多行视图)上方,而不是在文本视图下方?
此外,还有一个max_height,您可以添加或设置max_lines属性。这可能会有所帮助。