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

  • 相关阅读:
    代码生成器
    怎样成为优秀的软件模型设计者[转]
    2010年部分节假日安排的通知
    Web开发工具整理
    JS模版
    Timer_MinBytesPerSecond,Timer_ConnectionIdle解决办法
    [原]Asp.Net提交后,刷新时事件触发问题解决
    [转]JS日期选择控件
    知道了sa密码,控制服务器
    调试
  • 原文地址:https://www.cnblogs.com/ch123456/p/6841364.html
Copyright © 2011-2022 走看看