Android day01

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.Activity常用方法  

View findViewbyId(int id)       //根据组件的ID取得组件对象   

setContentView(int layoutResID)   //设置布局文件,设置显示组件

 3.TextView   

android:maxLength="6"                  //允许最大字符数   

android:textColor="FF0000"             //文字的颜色   

android:textSize="50px"                //文字的大小   

android:textStyle="blod"               //文字样式   

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

android:layout_margin="100px"          //外边距   

android:background="@drawable/a"       //背景   

android:id="@+id/id值"                 //设置id的值

getText().toString();   //获得控件的文本内容   

setText();  //设置控件的文本内容   

注意:<!--     -->:注释

 4.Button  

5.EditText   

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

原文地址:https://www.cnblogs.com/wangjinshabi250/p/6864078.html