zoukankan      html  css  js  c++  java
  • 事件处理(二)

    2.下拉框事件
    sp.setOnItemSelectedListener(new OnItemSelectedListener() {
    //一级联
    public void onItemSelected(AdapterView<?> arg0, View view,
    int position, long id) {
    TextView tView = (TextView) view;
    string = tView.getText().toString();
    tv.setText(string);
    if (string.equals("湖南")) {
    hnAdapter
    .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sp2.setAdapter(hnAdapter);
    } else if (string.equals("湖北")) {
    hbAdapter
    .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sp2.setAdapter(hbAdapter);

    } else if (string.equals("广东")) {
    gdAdapter
    .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sp2.setAdapter(gdAdapter);

    }

    }
    3.日期时间事件
    tp.setOnTimeChangedListener(new OnTimeChangedListener(){

    public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
    // TODO Auto-generated method stub
    tView.setText(hourOfDay+":"+minute);
    }});
    dp.init(2017 , 06 , 19, new DatePicker.OnDateChangedListener() {

    public void onDateChanged(DatePicker view, int year, int monthOfYear,
    int dayOfMonth) {
    // TODO Auto-generated method stub
    tView.setText(" "+year+" "+(monthOfYear+1)+" "+dayOfMonth);
    }
    });

    4.按钮选项改变事件
    rg.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
    rb=(RadioButton) findViewById(checkedId);
    String txt=rb.getText().toString();
    tv.setText(txt);
    }
    });

  • 相关阅读:
    1.28
    1.27
    1.26
    如果给你以下功能怎么测试
    测试面试题
    对h5页面的测试方式
    完美解决linux下Django报错Error: That port is already in use.
    KeyError:使用Python的Appium中的“ touchAction” 错误码
    Appium自动化测试
    selenium IDE使用
  • 原文地址:https://www.cnblogs.com/ch123456/p/6869538.html
Copyright © 2011-2022 走看看