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

  • 相关阅读:
    SQL in查询报告类型转换失败的3种解决办法
    JS获取TextArea和Input的同步值
    Java接口修饰符详解
    Lua协程的一个例子
    windows命令查看端口占用情况
    重装Zend Studio后如何恢复之前的设置
    现代软件工程第二周的作业
    现代软件工程第一周第一次作业
    现代软件工程第一周作业
    flex属性
  • 原文地址:https://www.cnblogs.com/ch123456/p/6841364.html
Copyright © 2011-2022 走看看