我正在使用以下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
的正下方}根据文本的大小。
答案 0 :(得分:3)
使用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>
答案 1 :(得分:2)
根据您的XML,您的视图设置在TextView(多行文本)之上,而不是在TextView之下?
此外,您还可以添加或设置max_height和max_lines属性。这可能有所帮助。