android alertdialog view,Android AlertDialog 方法setView(view,0,0,0,0)开发自定义对话框
如果使用m_currDlg = new AlertDialog.Builder(m_activity).create();m_currDlg.setView(textEntryView,0,0,0,0);m_currDlg.show();则可以得到想要的自定义的dialog此时就可以控制Dialog在按了OK或者cancel的显示还是消失了LayoutInflater factory = Layo
如果使用
m_currDlg = new AlertDialog.Builder(m_activity).create();
m_currDlg.setView(textEntryView,0,0,0,0);
m_currDlg.show();
则可以得到想要的自定义的dialog
此时就可以控制Dialog在按了OK或者cancel的显示还是消失了
LayoutInflater factory = LayoutInflater.from(m_activity);
final View textEntryView = factory.inflate(R.layout.dialog_edit_text, null);
EditText etCon = (EditText)textEntryView.findViewById(R.id.edittext_edit);
etCon.setText(strContent);
TextView tvCon = (TextView)textEntryView.findViewById(R.id.edittext_view);
m_btnConfirm = (Button)textEntryView.findViewById(R.id.plsBtnConfirm);
m_btnCancel = (Button)textEntryView.findViewById(R.id.plsBtnCancel);
if (0 != strTitle.length())
tvCon.setText(strTitle);
m_currDlg = new AlertDialog.Builder(m_activity).create();
m_currDlg.setView(textEntryView);
m_currDlg.show();
View.OnClickListener clickListener = new View.OnClickListener(){
@Override
public void onClick(View v) {
long id = v.getId();
if(id == R.id.plsBtnConfirm){
EditText etPl = (EditText)textEntryView.findViewById(R.id.edittext_edit);
String str = etPl.getText().toString().trim();
boolean bValid = UtilFun.isInputTextValid(str);
if (!bValid)
{
showWarningDlg("",m_activity.getString(R.string.str_invalid_playlist));
}
else
{
boolean bDismiss = isPlaylistNameValid(str,NEWPLS_INPUT);
if(bDismiss == true) m_currDlg.cancel();
}
}else if(id ==R.id.plsBtnCancel){
m_currDlg.cancel();
}
}
};
m_btnConfirm.setOnClickListener(clickListener);
m_btnCancel.setOnClickListener(clickListener);
更多推荐
所有评论(0)