final View contentView = LayoutInflater.from(this).inflate(
R.layout.popup_select_mode, null);
final PopupWindow popup = new PopupWindow(contentView,
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
popup.setBackgroundDrawable(getResources().getDrawable(
android.R.color.white));
popup.showAsDropDown(view);
group = (RadioGroup) contentView.findViewById(R.id.radio_group);
group.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton button = (RadioButton) contentView
.findViewById(checkedId);
Toast.makeText(MainActivity.this, button.getText(),
Toast.LENGTH_LONG).show();
popup.dismiss();
}
});
版权声明:本文为博主原创文章,未经博主允许不得转载。