我有这个
<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:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:ellipsize="end" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:maxLines="1" />
</LinearLayout>
但我希望text2具有更高优先级&#34;比text1
含义在屏幕不适合的情况下,我需要有这种行为:
Text2必须始终完全显示在一行中,除非它超过80%的屏幕,在这种情况下使用&#34; ...&#34;
Text1使用Text2剩下的任何空间,可以使用多行,如果它不合适,它应该使用&#34; ...&#34;最后
这可能与LinearLayout有关,或者我应该使用不同的容器吗?
答案 0 :(得分:1)
考虑使用ConstraintLayout
https://developer.android.com/training/constraint-layout/index.html
答案 1 :(得分:-1)
您最好的选择是使用Fragments,请参阅本教程:
https://developer.android.com/training/basics/fragments/creating.html#Create
它们可以准确地找到你要找的东西。