我希望当我点击edittext时,它应该显示一个弹出窗口,其上有带项目列表的单选按钮,当我选择一个项目时,它应该在edittext中显示它。怎么做?我没有得到它的解决方案。请告诉任何人。
答案 0 :(得分:0)
et1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// at this u use alert box with radio buttons
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//leave blank
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
//leave blank
// TODO Auto-generated method stub
}
});
答案 1 :(得分:0)
您也可以使用
disValEdit.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP) {
} });
答案 2 :(得分:0)
您可以尝试这样的事情:
textView.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
textView.setText(which);
}
});
builder.show();
}
});