zoukankan      html  css  js  c++  java
  • 让Android的输入框与文本框带滚动条ScrollView

    我们都知道EditText与TextView是Android的文本输入框和文本显示框,但是基于手机屏幕的大小因素,如果在需要输入较多文字或者显示较多内容的时候,手机屏幕是远远不够的,因此让文本框具有滚动条的功能是手机上必备的,下面ATAAW.COM来介绍下如何加上滚动条。 

    要加上滚动条,其实很简单,只需要在文本输入框或者文本显示框上面加上滚动条控件即可,该控件名字为ScrollView,以下我们对比下(以TextView举例)。 

    A、未加滚动效果 

    Java代码 
    <TextView   
    android:layout_width="fill_parent"
    android:layout_height
    ="wrap_content"
    android:id
    ="@+id/textView"
    />



    B、加上滚动效果 

    Java代码 
    <ScrollView   
    android:id="@+id/scrollView"
    android:layout_width
    ="fill_parent"
    android:layout_height
    ="200px"
    android:scrollbarStyle
    ="outsideOverlay" android:background="@android:drawable/edit_text">
    <TextView
    android:layout_width="fill_parent"
    android:layout_height
    ="wrap_content"
    android:id
    ="@+id/textView"
    />
    </ScrollView>


    由以上例子可以看出,只需要在文本控件的外围加上ScrollView控件就可以让文本框具有滚动体的功能。 


    转自:http://zkl-1987.iteye.com/blog/1055417

  • 相关阅读:
    单例模式
    pandas to_html
    restful
    numpy版本查看以及升降
    视频下载
    转载:caffe中的Reshape层
    caffe编译报错解决
    python 版Faster Rcnn
    转载:动态规划以及路径记录
    TensorFlow设置GPU占用量
  • 原文地址:https://www.cnblogs.com/shanzei/p/2415240.html
Copyright © 2011-2022 走看看