弹出复选框选择

时间:2011-03-06 02:20:25

标签: android checkbox popup

如何在Android中选中复选框后立即显示弹出窗口?

1 个答案:

答案 0 :(得分:2)

CheckBox yourCheckBox = (CheckBox) findViewById( R.id.yourCheckBox );
yourCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
   public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
   {
      if (isChecked)
         {
            //call popup
         }
   }
});

您只需要在文本框中为CheckedChanged事件声明一个回调,然后触发显示弹出窗口的方法

相关问题