zoukankan      html  css  js  c++  java
  • 基本控件的使用

    2.Activity常用 的方法
    View findViewById(int id) 根据组件的ID取得组件对象
    setContentView(int layoutResID) 设置布局文件,设置显示组件
    3.TextVies


    android:maxLength="6" 允许最大字符数
    android:textSize="100px" 文字大小
    android:textStyle="bold" 文字样式
    android:password="true" 是否以密文方法显示
    android:layout_margin="100px" 外边距
    android:background="@id(图片存放的文件夹名)/id(图片名)" 设置id的值
    getText().toString() 获取空间的文本内容
    setText(); 设置控件的文本内容
    注意:<!-- -->注释
    4.Button
    5.EditText
    android:enabled="false" 设置是否可用(false不可用)
    6.RadioButton(单选按钮)
    嵌入到RadioGroup中实现单选效果
    android:checkedButton="radio的id值"
    int getCheckedRadioButtonId();获得被选中的radiobutton的id
    7.ImageView(图片空件)
    android:src 图片资源ID
    android:maxWidth 最大宽度
    android:maxHeight 最大高度
    android:adjustViewBounds 设置为true,则maxWidth和maxHeight生效
    8.ImageButton(图片按钮)
    9.TimePicker(时间控件)
    viod updateDate(int year,int monthOfYear,int dayOfMonth)
    注意:mothOfYear是从0-11表示1-12月
    11.Spinner
    11.1下拉列表项的配置方式
    a.资源文件配置
    第一步:在string.xml配置
    <string-array name="citys">
    list.add("湖南");
    list.add("上海");
    list.add("北京");
    </string-array>
    第二步:指定资源
    android:entries="@arryay/citys";
    b.适配器配置
    第一种:资源配置
    ArrayAdapter<CharSequence> adapter=
    ArrayAdapter.createFromResource(
    this,资源id, 列表显示的样式 );

    第二种:资源配置
    ArrayAdapter<CharSequence> adapte=
    new ArrayAdapter<CharSequence>(
    this,android.R.layout.simple_spinner_item,(列表显示的样式),list(集合数据);

  • 相关阅读:
    神奇的条件注解-Spring Boot自动配置的基石
    Spring 注解配置原理
    元注解之@Repeatable
    MyBatis批量操作
    MapperScannerConfigurer源码解析
    Spring包扫描机制详解
    SqlSessionTemplate源码解析
    DataSourceUtils源码分析
    Spring事务源码分析
    多核CPU
  • 原文地址:https://www.cnblogs.com/hewei-666/p/6874636.html
Copyright © 2011-2022 走看看