Android TextView Text not getting wrapped

前端 未结 24 1441
时光说笑
时光说笑 2020-11-27 02:51

Can anyone tell me what\'s going wrong with the text? Text longer than one line doesn\'t wrap to the next line but goes beyond the screen.

Following is the code:

相关标签:
24条回答
  • 2020-11-27 03:30

    Increase the height i.e.. android:height="Some size" , it is working fine for me.

    0 讨论(0)
  • 2020-11-27 03:30

    you have to use android:singleLine="false" in ur TextView tags.

    0 讨论(0)
  • 2020-11-27 03:31

    Set the height of the text view android:minHeight="some pixes" or android:width="some pixels". It will solve the problem.

    0 讨论(0)
  • 2020-11-27 03:31

    Even-though this is an old thread, i'd like to share my experience as it helped me. My application was working fine for OS 2.0 & 4.0+ but for a HTC phone running OS 3.x the text was not wrapping. What worked for me was to include both of these tags.

    android:maxLines="100"
    android:scrollHorizontally="false"
    

    If you eliminate either it was not working for only the os 3.0 device. "ellipsize" parameter had neutral effect. Here is the full textview tag below

    <TextView
                    android:id="@+id/cell_description"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="5dp"
                    android:maxLines="100"
                    android:scrollHorizontally="false"
                    android:textStyle="normal"
                    android:textSize="11sp"
                    android:textColor="@color/listcell_detail"/>
    

    Hope this would help someone.

    0 讨论(0)
  • 2020-11-27 03:32

    It is enough to use in your xml file.

    android:singleLine="false".
    

    Hope it will work.

    All the best!

    0 讨论(0)
  • 2020-11-27 03:32

    I had a similar problem where were my two horizontally weighted TextViews didn't wrap the text. I later found out that the issue was because my viewparents parent had wrap_content instead of match_parent.

    0 讨论(0)
提交回复
热议问题