第二周小结

来源:互联网 发布:张国荣死亡之谜 知乎 编辑:程序博客网 时间:2024/05/18 03:12
LinearLayout
    父容器:
      方向:垂直/水平
      gravity:控制控件的位置
    子控件:
      weight:分配空间
        注意:
             方向水平 宽度0
             竖直:   高度0
      layout_gravity:相对于父容器布局
        注意:
            垂直   如果居中 竖直不能居中
            水平   如果居中 水平不能居中

  RelativeLayout:相对布局
    1:相对于父亲
      ①相对于父亲的居中方式
       centerInParent   true/false
      ②相对于父亲的对齐方式

       alignParent(Bottom) true/false

Toast  (吐司)

布局 + 控件
  TextView
   字体   textSize  textColor
   超链接 autoLink
   行数   maxLines  lines
   drawableLeft
  EditText
   ems:最大显示的字符数
   hint:默认提示
   inputType
   maxLines
  Button
   点击事件
    1:android:onCLick ="方法名字"  java: public void 方法名(View v){}
    2:观察者模式 java 接口的方式 接口回调
      //被观察者
      ① Button btn = (Button)findViewById(R.id.xxx);

        实现  View.OnClickListener
        btn.setOnClickListener(this)

        //观察者
        onClick(View v){
            点击时间
        }
  ImageView
    src:
    scaleType: center  centerCrop fitCenter  fitXY

原创粉丝点击