我尝试做布局有两个TextView的和一个线性布局:如何修复LineLayout的最后一个元素,使其不超出屏幕边界?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/holo_orange_dark"
android:text="testsdddddddddddddddddddddddddddasdsdfsdfsdf"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_red_dark"
android:maxLines="1"
android:text="NOT HIDE TEXT"/>
</LinearLayout>
但是,当第一个元素有许多字符第二个文本是hidding。 但我想这样做: 当第一个文本短(或第二元素可以全部不填aviliable区): 我可怎么办呢?可能是我需要使用RelativeLayout? 非常感谢您的回答)
为了什么?我希望第二个元素不要缩小并且在屏幕后面。 –
如果你想要第二个布局使用而不是Relative和LinearLayout,它们将不起作用。 –
你能写例子吗? –