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);

  • 相关阅读:
    hdu_2224_The shortest path(dp)
    hdu_4824_Disk Schedule(dp)
    hdu_5680_zxa and set(想法题)
    hdu_5683_zxa and xor(非正解的暴力)
    hdu_1429_胜利大逃亡(续)(BFS状压)
    hdu_1254_推箱子(双BFS)
    hdu_1969_pie(二分)
    hdu_2446_Shell Pyramid(数学,二分)
    hdu_2141_Can you find it?(二分)
    5.2 nc + JMX查看分布式程序数据
  • 原文地址:https://www.cnblogs.com/yuanyifei/p/4114807.html
Copyright © 2011-2022 走看看