我想并排2个TextViews,溢出在TextView1下面:
遇到的问题是两个TextViews创建了两列,这阻止了TextView2的文本在TextView1下面。
我该怎么做?
答案 0 :(得分:1)
使用RelativeLayout
将您的观点与其他观点相关联。
例如:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView1"/>
<TextView
android:id="@+id/textview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView2"
android:layout_toRightOf="@id/textview1"/>
</RelativeLayout>
答案 1 :(得分:0)
这可能会有所帮助。
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView android:layout_width="0dp"
android:layout_weight="50"
android:layout_height="match_parent"
/>
<TextView android:layout_width="0dp"
android:layout_weight="50"
android:layout_height="match_parent">
</LinearLayout>