Java 如何防止TextView被截断
我在listView上面有一个TextView,一旦listView达到与屏幕相同的高度(需要滚动某些列表项才能看到),文本视图就会变成“…” 有没有办法防止这种情况发生? 编辑: 好吧,这太尴尬了。。。Java 如何防止TextView被截断,java,android,Java,Android,我在listView上面有一个TextView,一旦listView达到与屏幕相同的高度(需要滚动某些列表项才能看到),文本视图就会变成“…” 有没有办法防止这种情况发生? 编辑: 好吧,这太尴尬了。。。 问题是服务器返回的是“…”而不是正确的字符串,很抱歉给您带来不便 你的问题不清楚。我使用recycler视图希望此代码能帮助您 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android
问题是服务器返回的是“…”而不是正确的字符串,很抱歉给您带来不便 你的问题不清楚。我使用recycler视图希望此代码能帮助您
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@color/color_white"
android:layout_height="match_parent"
tools:context=".AffectedCountries">
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:text="search"
android:textSize="40dp"
/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edtSearch"
android:layout_margin="5dp"
android:padding="5dp"
android:id="@+id/recyclerAffectedCountries">
</androidx.recyclerview.widget.RecyclerView>
</RelativeLayout>
发布xml代码并添加ss或GIF请正确解释listview变为bigOK时的含义。尝试此操作-使TextView高度“包裹内容”和宽度与父级匹配。将ListView高度设置为0dp,与父级不匹配。使用线性布局这将很容易完成,但建议您尝试使用约束布局,这样更灵活。@Ashish by big我的意思是它占用活动中的所有空间(现在您需要滚动查看所有项目)。在我的情况下,我不知道文本高度如何,所以我设置了换行内容,你能试着也这样做吗?结果会和我的ans帮助你的结果一样吗?