6

我正在开发一个AppWidget需要TextView将文本显示为选框的地方。我尝试使用以下代码(就像在常规代码中所做的那样Activity),但文本不会滚动。

<TextView
    android:layout_width="150dip" 
    android:layout_height="wrap_content"
    android:text="@string/marquee_forever"
    android:singleLine="true"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever" />

谁能告诉我如何解决这个问题?

4

3 回答 3

4

您需要在 xml 中为选取框添加以下属性:

    android:singleLine="true" 
    android:ellipsize="marquee"
    android:marqueeRepeatLimit ="marquee_forever"
    android:scrollHorizontally="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
于 2010-10-04T12:02:22.160 回答
2

The marquee will appear when the content of the Textview should be larger than width.Make sure the input occupies the greater space than width.

于 2010-10-04T10:53:41.257 回答
0

The text will only scroll if the TextView is either in the selected or focused state and, as Praveen indicates, the text is wider than the available width of the TextView. I have not experimented with getting a TextView in the selected or focused states in an app widget. Perhaps this or this previous StackOverflow answers will give you some things to try.

于 2010-10-04T10:55:35.577 回答