Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 文本视图选框不滚动_Android_Marquee - Fatal编程技术网

Android 文本视图选框不滚动

Android 文本视图选框不滚动,android,marquee,Android,Marquee,我花了几个小时试着用谷歌搜索。我看过其他的帖子,但没有任何效果。 我确实有电视;在我的代码中 ` ` 这是我的文本视图 <TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="match_parent" android:ellipsize="marquee" android:focusable="true" androi

我花了几个小时试着用谷歌搜索。我看过其他的帖子,但没有任何效果。 我确实有电视;在我的代码中

`

`

这是我的文本视图

<TextView
    android:id="@+id/tv"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    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:textSize="30sp" />

将下面的[tv.setSelected(true);]放置到setContentView(R.layout.activity_main)中

在xml中

   <TextView
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:text=""
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:singleLine="true" />

只需在OnCreate方法中这样做即可

    yourTextView= (TextView) findViewById(R.id.yourTextViewID);

    yourTextView.setSelected(true);
    yourTextView.setEllipsize(TruncateAt.MARQUEE);
    yourTextView.setSingleLine(true);

您是否在设备或模拟器上进行过测试?
   <TextView
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:text=""
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:singleLine="true" />
    yourTextView= (TextView) findViewById(R.id.yourTextViewID);

    yourTextView.setSelected(true);
    yourTextView.setEllipsize(TruncateAt.MARQUEE);
    yourTextView.setSingleLine(true);