TextView加上滚动条

来源:互联网 发布:mac怎么强制退出程序 编辑:程序博客网 时间:2024/06/16 12:49
方式一:
1)<TextView 
    android:scrollbars="vertical" 
    />
2)还需要在代码中设置 TextView 相应的方法
TextView textView = (TextView)findViewById(R.id.text_view);  
textView.setMovementMethod(ScrollingMovementMethod.getInstance());
注意如果想要滚动条时刻显示, 必须加上以下语句:
textView.setScrollbarFadingEnabled(false);


方式二:
<ScrollView   
    android:layout_width="fill_parent"   
    android:layout_height="wrap_content" >   
    <TextView />   
</ScrollView>  
0 0
原创粉丝点击