TextView的问题文本对齐 [英] Textview issue with text align

查看:120
本文介绍了TextView的问题文本对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我想简单的问题,但是我找不到任何解决的办法。 我有一个TextView的宽度 - WRAP_CONTENT。 我把它对准的权利和内部线性布局。 这种线性布局可能最多可以说200dp所以TextView的最大宽度为200dp了。 每当我现在键入一些文字让我们说: Dhasdhjads。ahsdjhasd。hjashjdashjdhs。 两个第一字出现在第一线路和明显的第三字被移动到下一个,因为没有足够的空间。 然而Eventho第三字是不是宽,前两个,TextView的花费,而不是只使用尽可能多的空间其需要最大的空间。 它看起来像

 第一页第二页--------------
第三个词
 

----是beign采取的不是寻找这样的自由空间:

 第一页第二页
第三个词
 

任何解决办法?

那么我的code TextView中的XML是:

 <的TextView
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:背景=@机器人:彩色/黑白
        机器人:单线=假
        机器人:文字颜色=@机器人:彩色/白/>
 

解决方案

安卓SINGLELINE =假安卓SINGLELINE =真正的

I have I guess simple problem however I cant find any solution to it. I have a textView in with width - wrap_content. I have it aligned to the right and inside linear layout. That linear layout might be max lets say 200dp so textView max width is 200dp too. Now whenever I type some text lets say: "Dhasdhjads. ahsdjhasd. hjashjdashjdhs." The two first words appear in first line and obviously the third word is moved to next because there is not enough space. However Eventho third word is not that wide that the first two, the textview takes max space instead of using only as much space as its needed. It looks like that

First Second--------------
Third word

---- is the free space that is beign taken instead of looking like that:

First Second
Third word

Any solution to this?

Well xml of my code Textview is:

 <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:color/black"
        android:singleLine="false"
        android:textColor="@android:color/white"/>

解决方案

Make android:singleLine="false" to android:singleLine="true"

这篇关于TextView的问题文本对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆