• android学习(2)


    1.开发Activity步骤
    第一步:写一个类继承Activity
    第二步:重写oncreate方法
    第三步:在主配置文件中注册activity
    <activity android:name=".类名"
    android:label="@string/app_name">
    <intent-filter>
    <!--app的入口-->


    <action android:name="android.intent.action.MAIN" />


    <!--桌面显示-->
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    2.Activiry常用方法
    View findViewById(int id)//根据组件的ID取得组件对象
    setContentView(int layoutResID)//设置布局文件,设置显示组件
    3.TextVies
      android:maxLength=""      //允许最字符数


      android:textColor=""       //文字的颜色
      android:textSize=""       //文字大小
      android:textStyle=""       //文字样式
      android:password=""      //是否以密文方式显示
      android:layout_margin=""    //外边距
      android:background=""      //背景样式
      android:id="" //设置id的值

      getText().toString() //获得控件的文本内容
      setText() //设置控件的文本内容
    注意:<!-- -->注释

    4.EditText(文件编辑框)

      android:password=""          //是否以密文方式显示

      android:enabled="false"          //设置是否可用,false不能用

      android: hint=””                       //水印

      android: numeric=”integer”                   //只能输入数字

    5.Button(按钮控件)

    6.RadioButton(单选按钮)

                嵌入到RadioGroup中实现单选效果

                    android: checkedButton=”radio的id值 ”;

                int getCheckedRadioButtonId( );                    //获得被选中的单选按钮的id

    7.CheckBox(复选框)

                    android: checked=”true”;                               //设置默认选中

                    CheckBox(Context context)                            //实例化CheckBox组件

                void setChecked(boolean checked)     //设置默认选中

    8.ImageView(图片控件)

                android: maxHeight=” ”;                                //图片的最大高度

                android: maxWidth=” ”;                                 //图片的最大宽度

                android: src=” ”;                                                         //图片的资源ID

                android: adjustViewBounds=” ”;         //设置为true,则maxHeight和maxWidth

    9.ImageButton(图片按钮)

    10.TimePicker(时间选择器)

        setIs24HourView(true);             //设置24小时制

        setCurrentHour();       //设置小时

        setCurrentMinute();      //设置分钟

    11.DatePicker(日期控件)


    //修改日期


    void updateDate(int year,int monthofYear, int dayOfMonth)


    注意:monthOfYear是从0-11表示1-12月

  • 相关阅读:
    win10离线安装WSL2 Ubuntu20.04系统
    合并挖矿 merged mining——是指在不牺牲整体挖矿性能的情况下同时挖矿两种或多种加密货币的行为
    P2Pool和它在去Monero采矿中心化的作用——门罗币支持p2p的方式挖矿
    如何设置并使用xmrigproxy——本质上就是一个中转代理,可以设置ssl
    黑客是如何利用你的浏览器进行挖矿的?
    CoinHive挖矿原理分析——后端是nodejs服务,前端直接miner.start即可
    挖矿算法和币种统计
    HDD挖矿——目前整体看情况不景气
    XMRig支持的挖矿算法
    coinhive.com 网页挖矿分析
  • 原文地址:https://www.cnblogs.com/etid/p/6867590.html
Copyright © 2020-2023  润新知