Android的布局溢出关注 [英] Android Layout Overflow Concern

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

问题描述

我在做一个song_item.xml文件,将进入一个ListView快速样机。

I was doing a quick mockup for a song_item.xml file that will go into a listView.

第一图像是所希望的输出,但是,如果歌曲标题太长,则它会溢出到第二线;隐藏的组名!

The first picture is the desired "output", however, if the song title is too long, then it will overflow into the second line; hiding the group name!

所以第二个画面是不是所需的输出

So the second picture is NOT the desired "output"

什么办法来克服这种,然后

* MAYBE * 谷歌已经表示,为什么只有3布局选择?匹配家长,家长填写,并进行总结的内容?为什么不设计一些用于能力静止溢出。你看人家编程创建实现的东西像滚动textViews解决方案等...

* * MAYBE * * has Google stated why there are only 3 layout choices? Match Parent, Fill Parent, and Wrap Content? Why not some layout abilities for "stationary overflows". You see people programmatically create solutions that achieve things like scrolling textViews, etc...


根据从user1374864建议(接受的答案)

这是与来自第二图像的输入时的输出,但使用user1374864的回答的一个修改版本。我可能会决定去与字幕,但现在...这是好事!

This is the output that occurs with the input from the second picture, but uses a modified versions of user1374864's answer. I might decide to go with the marquee, but for right now...this is good!

推荐答案

您可以将下面的行添加到歌曲标题TextView的。

you can add the following lines to the Textview of the song title.

android:singleLine="true"
android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true" 

这迫使你的TextView是只有单线和选取框的文本,如果太长。

It forces your TextView to be only a singleline and marquee the text if it is too long.

这篇关于Android的布局溢出关注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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