小编Dan*_*gen的帖子

Textview滚动无法正常工作

我想垂直向下和向上滚动文本,使文本中出现的文本比空格更长.但是,我测试的下面的方法,不起作用.

1 - tv1.setMovementMethod(new ScrollingMovementMethod()); 此外,使用此方法时,调用onFling()方法停止工作.

2 - <ScrollView>在布局XML中使用.此外,使用此方法时,调用onFling()方法停止工作.

<ScrollView
android:id="@+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fillViewport="true">

    <TextView
    android:id="@+id/TEXT_STATUS_ID"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1.0"/>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

布局XML中的TextView如下所示.

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="2.26"
    android:background="@drawable/green"
    android:gravity="center"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />
Run Code Online (Sandbox Code Playgroud)

xml layout android scroll textview

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

layout ×1

scroll ×1

textview ×1

xml ×1