Android 椭圆选框/结束

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12277994/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:18:22  来源:igfitidea点击:

Ellipsize marquee/end

android

提问by Syamantak Basu

I just came to know about using ellipsize in a Text View. But I cannot understand what difference in effect am I supposed to get if I set android:ellipsize="marquee" rather than using android:ellipsize="end".I am new to android. Please help.

我刚刚知道在文本视图中使用椭圆大小。但是我无法理解如果我设置 android:ellipsize="marquee" 而不是使用 android:ellipsize="end" 会产生什么不同的效果。我是 android 新手。请帮忙。

回答by Vijay Vankhede

words that are longer than the view is wide to be ellipsized instead of broken in the middle. You will often also want to set scrollHorizontally or singleLine as well so that the text as a whole is also constrained to a single line instead of still allowed to be broken onto multiple lines.

长于视图的单词宽以省略而不是在中间断开。您通常还希望设置 scrollHorizo​​ntally 或 singleLine,以便将整个文本也限制在一行中,而不是仍然允许分成多行。

Must be one of the following constant values.

必须是以下常量值之一。

Suppose original value text view is aaabbbcccand its fitting inside the view

假设原始值文本视图是aaabbbccc并且它适合在视图中

Constant    Value   Description
none         0      
start        1      output will be : ...bccc
middle       2      output will be : aa...cc
end          3      output will be : aaab...
marquee      4      out put will be : aaabbbccc auto sliding from right to left

回答by Sankar

If you want to make your textview to scroll horizontally then ellipsize "marquee" will only work. Ellipsize "end" will help you to make your textview ellipsize with "..."

如果你想让你的 textview 水平滚动,那么 ellipsize “marquee” 只会起作用。Ellipsize "end" 将帮助您使用 "..." 使 textview 椭圆化

回答by Akanksha Hegde

If you want a horizontal scrollable text in your app, use

如果您想在应用中使用水平滚动文本,请使用

android:ellipsize="marquee"

where a single line large text will be scrolling.

其中单行大文本将滚动。

But in case if you use,

但如果你使用,

android:ellipsize="end"

text after the end of screen will be shown as

屏幕结束后的文本将显示为

...

...