我需要创建一个从屏幕一端移动到屏幕底部的另一端的视图。意味着像在新频道中的快闪新闻在底部连续移动。类似的概念是我想要的。我不知道要使用什么小部件。我尝试了翻转器,但只有 1 个文本视图被另一个替换。我需要它从一端移动到另一端并更改内容。任何人都可以帮忙吗?
我尝试使用 marquee 使用下面提到的答案..但它仍然没有移动..
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
t = (TextView) findViewById(R.id.label);
t.setSelected(true);
}
//xml
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:text="@string/hello_world"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
/>
有效。问题实际上是我给了一个非常小的字符串(你好世界)现在我给了一个新的长字符串。所以它起作用了