如何防止TextView被截断

huangapple go评论65阅读模式
英文:

How to prevent TextView from being truncated

问题

我在一个ListView上面有一个TextView,一旦ListView的高度达到与屏幕相同的高度(即一些列表项需要滚动才能看到的时候),TextView就会变成“...”。

有没有办法阻止这种情况发生?

如何防止TextView被截断

如何防止TextView被截断

编辑:
嗯,这有点尴尬...
问题是服务器返回的是'...',而不是正确的字符串,为此造成的不便我深感抱歉!

英文:

I have a TextView above a listView, and once the listView reaches the same height as the screen,(the moment some of the list items need to be scrolled-to to be seen) the text view turns into "..."

is there any way to prevent this from happening?
如何防止TextView被截断

如何防止TextView被截断

EDIT:
well, this is embarrassing...
the problem was that the server was returning '...' instead of the proper string, sorry for the inconvenience!

答案1

得分: 0

<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">

    &lt;TextView
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_margin="10dp"
        android:text="搜索"
        android:textSize="40dp"
       /&gt;

    &lt;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"&gt;

    &lt;/androidx.recyclerview.widget.RecyclerView&gt;
&lt;/RelativeLayout&gt;
英文:

your question is no clear. i use recycler view hope this code will help you

&lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
        xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
        xmlns:tools=&quot;http://schemas.android.com/tools&quot;
        android:layout_width=&quot;match_parent&quot;
        android:background=&quot;@color/color_white&quot;
        android:layout_height=&quot;match_parent&quot;
        tools:context=&quot;.AffectedCountries&quot;&gt;
    
        &lt;TextView
            android:layout_width=&quot;match_parent&quot;
            android:layout_height=&quot;45dp&quot;
            android:layout_margin=&quot;10dp&quot;
            android:text=&quot;search&quot;
            android:textSize=&quot;40dp&quot;
           /&gt;
    
        &lt;androidx.recyclerview.widget.RecyclerView
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
            android:layout_below=&quot;@id/edtSearch&quot;
            android:layout_margin=&quot;5dp&quot;
            android:padding=&quot;5dp&quot;
          android:id=&quot;@+id/recyclerAffectedCountries&quot;&gt;
    
        &lt;/androidx.recyclerview.widget.RecyclerView&gt;
    &lt;/RelativeLayout&gt;

huangapple
  • 本文由 发表于 2020年9月16日 19:37:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63919251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定