我想要的是 :
如果文字较短,则21%TextView
应该位于第一个文字旁边,TextView
如下所示
当文本很长时,我希望第一个TextView
达到结尾并变成椭圆形,并且TextView
应该显示21%,如下所示
但是我所做的21%TextView都消失了,并且首先TextView占据了完整的空间。我尝试了与Linear, Relative, Frame, Constraint layout, weight, minwidthetc的多种组合,但似乎没有任何效果。
这是我的xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_job_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce pulvinar nec justo id bibendum." />
<TextView
android:id="@+id/tv_matchPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:text="21% "
android:textColor="#4268e3"/>
</LinearLayout>
知道如何实现吗?
注意:我不想硬编码字符或宽度
qq_笑_17
相关分类