【问题标题】:Marquee won't scroll when using short text使用短文本时选取框不会滚动
【发布时间】:2012-03-21 21:48:41
【问题描述】:

我想将 marquee 属性用于短文本。我写了这段代码:

<TextView
        android:id="@+id/MarqueeText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:freezesText="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:paddingLeft="15dip"
        android:paddingRight="15dip"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="Hello" >

它不起作用。但是当我将文本更改为“你好你好你好你好等”时(长文本)它有效。如何在短文本中使用选取框?

【问题讨论】:

    标签: android text textview marquee short


    【解决方案1】:

    您的layout_width 不使用fill_parent,而是使用设置的宽度。当字符长于 View 的宽度时启用选取框。

    【讨论】:

    • 非常感谢,你救了我!
    • 这对我没有任何影响。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 2016-01-11
    • 1970-01-01
    相关资源
    最近更新 更多