我是安乐斯方案拟定工作的非常新鲜事,我已读到任何地方,我似乎无法找到任何解决办法。
Basic problem is that I have a TextView in a widget and I would like the text to scroll when the text is longer than the TextView layout_width. This is my code in the layout_widget.xml
<TextView android:id="@+id/fact" android:layout_width="200dp"
android:text="Loading... More text to see if it spans or not and want more"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true" />
现在我的理解是,我必须把案文放在重点上,我已经这样做。 我也读到,你需要确定setS selected(true) 的财产,这是我正在努力确定的情况。 在我的缺席活动中(安妮·曼尼费斯·xml) 我有以下法典。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.widget_layout);
findViewById(R.id.fact).setSelected(true);
setContentView(R.layout.main);
}
The part below is used to set the content to the widget_layout.xml and subsequently set the textView property for setS selected to real
setContentView(R.layout.widget_layout);
findViewById(R.id.fact).setSelected(true);
然后,我将内容意见退回主编。
现在,我猜测这是错误的,这不是应该做的。 但是,我很想知道能否做到这一点。 我也读到,如果你能够推翻《框架》,你也可以把自己的财产列入,例如《意见》中? 我也谈到SDK版本7。
我非常赞赏我得到的帮助,感谢大家!
Edit: By removing setContentView(R.layout.main); when launching the application via the app draw, the text does scroll, but the widget doesn t. Kind of leads me to that a widget cannot have a marquee??? Has anyone got a marquee working on a widget??
www.un.org/Depts/DGACM/index_spanish.htm Edit2: Solved。 这就是如何做到这一点。
在案文的xml中,你需要一个标签 基本上,我认为,这和被欺骗(真实)一样。
So the code should be as followed:
<TextView android:id="@+id/fact" android:layout_width="200dp"
android:text="Loading... More text to see if it spans or not and want more"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:duplicateParentState="true">
<requestFocus android:focusable="true" android:focusableInTouchMode="true"
android:duplicateParentState="true" />
</TextView>