zoukankan      html  css  js  c++  java
  • 安卓_5

    监听器

    OnClickListener

    OnChecjedChangeListener

    //===========

    1、单选按钮的基本概念

    2、radiogrounp与radiobutton

    3、onClickListener与OnCheckedChangeListener监听器

    //=====================

    什么是Radio

    1.XML文件:

    <RadioButton/>&<radioGroup/>

    2.代码RadioButton&RadioGroup//findViewById

    3.常用OnClickListener与OnCheckedChangeListerner监听器

    //==========================

    <Linerlayout>

    android:orientation = "vertical"

    <RadioGroup

      android:orientation ="horital"

        <RadioButton

          />

        <RadioButton

          />

    /RadioGroup>//有子标签

    <TextView />无

    //==========================

    ->MainActivity

    private RadioGroup radioGroup;

    private RadioBUtton femaleButton;

    private RadioBUtton malebutton;

    RadioGroupListener listener = new RadioGroupListener();

    radioGroup.setOnCheckedChangeListener(listener);

    //===================

    绑定监听器

    class RadioGroupListener implents OnCheckedChangeListener{

    public void onCheckedChanged(RadioGroup group,int checkId)

    {

    //==========Id 是R.java中生成的

       if(checkedId == famaleButton.getId()){

        System.out.println("");  

    }else{

    }

    }

    }

    }

     //=====================

    class RadioButtonListener implements android.widget.compoundButton.OnCheckedChangeListener{

    public void onCheckedChanged(CompoundButton button,boolean isChecked)

    {

    }

    }

    //==========================

    RadioButtonListener radionBUttonListener = new RadioButtonListener();

    femaleButton.setOnCheckedChangeListener(radioButtonListener);

  • 相关阅读:
    Go-闭包
    GO-数组与切片
    Go-包
    Go-for循环
    GO-逻辑判断(if,else if,else,switch)
    前后端分离的思考与实践(六)
    前后端分离的思考与实践(五)
    前后端分离的思考与实践(三)
    前后端分离的思考与实践(二)
    前后端分离的思考与实践(一)
  • 原文地址:https://www.cnblogs.com/yuanyifei/p/4114807.html
Copyright © 2011-2022 走看看