安卓开发 xml添加滑动条
在layout上显示文字时,因为字数过多不能全部显示,可以添加一个滚动条
在layout中
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"//加滚动条
android:singleLine="false"
android:text="" />
在MainActivity中
tv = (TextView)findViewById(R.id.tv);
tv.setMovementMethod(ScrollingMovementMethod.getInstance());
就能添加滚动条了!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。