Android 设置一个TextView可以垂直滚动

来源:互联网 发布:office电脑版办公软件 编辑:程序博客网 时间:2024/05/01 02:01

TextView设置了高度,超过了的内容就看不到了,这个时候我们设置其本身提供的scrollbars

垂直 :vertical

水平:horizontal

<TextView    android:id="@+id/textView1"    android:layout_width="match_parent"    android:layout_height="200dp"    android:layout_weight="2.89"    android:maxLines="12"    android:scrollbars="vertical"    android:text=" "    android:textColor="#000" />
private TextView LocationResult;LocationResult = (TextView)findViewById(R.id.textView1);LocationResult.setMovementMethod(ScrollingMovementMethod.getInstance());//主要是这句话在起作用
0 0
原创粉丝点击