码迷,mamicode.com
首页 > 移动开发 > 详细

android第二章控件1

时间:2017-05-16 12:48:46      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:resid   and   set   ttext   edittext   ble   文本   tco   像素   

1.Activity:用于存放各个显示控件,是android的基本组成

2.Activity常用方法:public final View findViewById(int id) 根据组件的id取得组件对象       public void setContentView(int layoutResIdd)  设置显示组件

3.设置控件的ID值:格式:@+id/ID值

4.TextView标签(标签按钮):  

    4.1常用属性:1:android:text //定义组件的显示文字       

           2:  textColor:     //设置文件的文本颜色       

           3:  textSize: //设置显示的文字大小       

           4:  textStyle: //设置文字显示的样式、粗体、斜体

     4.2设置文字的显示风格:    normal(正常)、bold(粗体)、italic(斜体)  

    4.3设置组件大小或文字大小:   

            px:像素;dip:依赖于设备的像素;

            sp:带比例的像素;pt:点;in:英尺;

            mm:毫米

5.   getText().toString()  //获得控件的文本内容    setText();   //设置控件的文本内容

6.  Button按钮:

     6.14.1常用属性:1:android:text //定义组件的显示文字          

             2:    textColor:     //设置文件的文本颜色       

            3.    enable="flase  or  ture" //值为false时不能按

7.EditText按钮(文本编辑宽)   

    7.1常用属性:1:android:text //定义组件的显示文字          

            2:    textColor:     //设置文件的文本颜色   

            3.    enable="flase  or  ture" //值为false时文本框不能编辑

android第二章控件1

标签:resid   and   set   ttext   edittext   ble   文本   tco   像素   

原文地址:http://www.cnblogs.com/22joke/p/6860330.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!