zoukankan      html  css  js  c++  java
  • 今日总结

    TextView(文本框)

    TextView中有下述几个属性:

    • id:为TextView设置一个组件id,根据id,我们可以在Java代码中通过findViewById()的方法获取到该对象,然后进行相关属性的设置,又或者使用RelativeLayout时,参考组件用的也是id!
    • layout_width:组件的宽度,一般写:**wrap_content**或者**match_parent(fill_parent)**,前者是控件显示的内容多大,控件就多大,而后者会填满该控件所在的父容器;当然也可以设置成特定的大小,比如我这里为了显示效果,设置成了200dp。
    • layout_height:组件的高度,内容同上。
    • gravity:设置控件中内容的对齐方向,TextView中是文字,ImageView中是图片等等。
    • text:设置显示的文本内容,一般我们是把字符串写到string.xml文件中,然后通过@String/xxx取得对应的字符串内容的,这里为了方便我直接就写到""里,不建议这样写!!!
    • textColor:设置字体颜色,同上,通过colors.xml资源来引用,别直接这样写!
    • textStyle:设置字体风格,三个可选值:**normal**(无效果),**bold**(加粗),**italic**(斜体)
    • textSize:字体大小,单位一般是用sp!
    • background:控件的背景颜色,可以理解为填充整个控件的颜色,可以是图片哦!

    EditText(输入框)

    默认提示文本的两个属性如下:

    android:hint="默认提示文本"
    android:textColorHint="#95A1AA"

    获得焦点后全选组件内所有文本内容

    android:selectAllOnFocus="true"

    限制EditText输入类型

    <EditText   
            android:layout_width="fill_parent"   
            android:layout_height="wrap_content"   
            android:inputType="phone" />  

    可选参数如下:

    文本类型,多为大写、小写和数字符号

    android:inputType="none"  
    android:inputType="text"  
    android:inputType="textCapCharacters"  
    android:inputType="textCapWords"  
    android:inputType="textCapSentences"  
    android:inputType="textAutoCorrect"  
    android:inputType="textAutoComplete"  
    android:inputType="textMultiLine"  
    android:inputType="textImeMultiLine"  
    android:inputType="textNoSuggestions"  
    android:inputType="textUri"  
    android:inputType="textEmailAddress"  
    android:inputType="textEmailSubject"  
    android:inputType="textShortMessage"  
    android:inputType="textLongMessage"  
    android:inputType="textPersonName"  
    android:inputType="textPostalAddress"  
    android:inputType="textPassword"  
    android:inputType="textVisiblePassword"  
    android:inputType="textWebEditText"  
    android:inputType="textFilter"  
    android:inputType="textPhonetic" 

    数值类型

    android:inputType="number"  
    android:inputType="numberSigned"  
    android:inputType="numberDecimal"  
    android:inputType="phone"//拨号键盘  
    android:inputType="datetime"  
    android:inputType="date"//日期键盘  
    android:inputType="time"//时间键盘

     

  • 相关阅读:
    hdu 1269 迷宫城堡 (并查集)
    hdu 1272 小希的迷宫 (深搜)
    hdu 1026 Ignatius and the Princess I (深搜)
    hdu 1099 Lottery
    hdu 1068 Girls and Boys (二分匹配)
    几个基础数位DP(hdu 2089,hdu 3555,uestc 1307 windy 数)
    hdu 1072 Nightmare (广搜)
    hdu 1398 Square Coins (母函数)
    hdu 1253 胜利大逃亡 (深搜)
    hdu 1115 Lifting the Stone (求重心)
  • 原文地址:https://www.cnblogs.com/feng747/p/14909068.html
Copyright © 2011-2022 走看看