zoukankan      html  css  js  c++  java
  • 基本控件(二)

    Activity常用方法
    setContentView(R.layout.xxxx);//设置布局文件
    getViewById(R.id.xxxx);//获取指定控件
    getString(R.String.xxxx);//获取Strings XML指定key的值
    注意:可以用Java代码生成界面,也可以用XMl编写界面,建议使用XML编写界面

    TextView(标签控件)
    android:text //显示文字
    android:maxLength //设置文本最大长度
    android:textColor //设置文本颜色
    android:textSize //设置文本大小
    android:textStyle //设置文本的样式(bold(粗体),italic(斜体))
    android:password //按密文方式显示文本(true/false)

    方法
    setText(String); //设置文本内容
    getText().toString; //返回文本内容
    android:layout_width //控件使用
    android:layout_heigth //控件高度
    android:id="@+id/id值" //设置控件的唯一标识
    android:background //设置背景
    注意:fill_parent :组件宽度/高度充满整个屏幕
            wrap_content:组件的宽度/高度为内容的实际宽度/高度

    Edit Text(输入框)
    android:selectAllOnFocus //在获得焦点时,会全选文本内容
    android:focusable //true表示获得焦点,false获得焦点(默认获得焦点)
    android:enabled //true表示不可编辑,false可以编辑(默认false)

    RadioButton(单选按钮)
       RadioGroup(单选按钮组)
          android:orientation="horizontal" //设置布局方式
          android:checkedButton="单选按钮id" //设置默认选中的单选按钮
    注意:单选按钮RadioButton,一般需要在RadioGroup中达到单选的目的

    方法:
    getCheckedRadioButtonId(); //获得选中的按钮id

  • 相关阅读:
    Arduino通信篇系列之print()和write()输出方式的差异
    通信协议之Modbus协议(一)
    CAD制图系列一之绘图、标注、修改、视图
    Arduino系列之pwm控制LED灯(呼吸灯)
    [转]GDB调试基础
    Linux上编辑然后执行一段脚本的机制
    [转]进程创建-终结流程图
    [ 转]Linux进程关系
    Linux进程管理(四、 进程终结)
    Linux进程管理(三、 线程)
  • 原文地址:https://www.cnblogs.com/ch123456/p/6841364.html
Copyright © 2011-2022 走看看