我知道这个问题已经被问过很多次了,但我似乎仍然无法解决这个问题。 我已经尝试了各种组合,但它只是拒绝换行到 2 行。
现在是这样的:
<TextView
android:id="@+id/doctor_details_clinic_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingRight="3dip"
android:textSize="12sp"
android:maxLines="1"
android:layout_gravity="right"
android:gravity="right"
android:scrollHorizontally="false"
android:singleLine="false"
android:ellipsize="none"
/>
我试过将宽度设置为 0dip 和所有其他建议但没有一致。
最佳答案
首先,您应该将最大行数设置为 2 而不是 1。
像这样的东西会起作用:
<TextView
android:id="@+id/myText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:ellipsize="end"
android:text="this is the most interesting use of text view I have seen so far,this is the most interesting use of text view I have ever seen so far,this is the most interesting use of text view I have ever seen so far this is the most interesting use of text view I have ever seen so far"/>
关于android - 让 TextView 换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12067302/