Dan*_*gen 6 xml layout android scroll 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)
yug*_*oid 11
你不能在里面有一个可滚动的View,TextView或者.所以在普通布局中使用简单的内部并为其添加属性.ListViewScrollViewTextViewandroid:scrollbars
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:lines="3"
android:scrollbars="vertical"
android:scrollbarStyle="insideOverlay"
android:fadeScrollbars="true"
android:fadingEdge="vertical" />
Run Code Online (Sandbox Code Playgroud)
在Activity一边你必须写一些像:
tv1.setMovementMethod(new ScrollingMovementMethod());
Run Code Online (Sandbox Code Playgroud)
(基本上与你在第一点描述的相同)
<ScrollView
android:id="@+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/TEXT_STATUS_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10446 次 |
| 最近记录: |