示例#1
0
 @Override
 public void onClick(View v) {
   if (this.equals(v)) {
     if (isShowing()) {
       menuDismiss();
     } else {
       showDropMenu();
     }
   } else if (getContext() != null && v.getId() == ITEM_ID) {
     int position = -1;
     try {
       position = Integer.parseInt(v.getTag().toString());
     } catch (NumberFormatException e) {
       e.printStackTrace();
     }
     if (position > -1 && position < lAdapter.getCount()) {
       lAdapter.switchSelected(position);
       menuDismiss();
     }
   }
 }