我正在尝试将文字设置为自定义EditText
中的AlertDialog
。我正在使用以下代码。
........
........
........
........
case R.id.edit:
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.editvslayout,
null);
new AlertDialog.Builder(this)
.setTitle(
Messages.getString("OSListActivity.52") + item_cursor.getString(1)) //$NON-NLS-1$
.setView(textEntryView)
.setPositiveButton(Messages.getString("OSListActivity.53"), //$NON-NLS-1$
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {// TODO update path
// update desc
EditText evsname = (EditText) textEntryView
.findViewById(R.id.vsname);
EditText evsdesc = (EditText) textEntryView
.findViewById(R.id.vsdesc);
evsdesc.setText(folderdesc);
evsname.setText(foldername);
........
........
........
........
然而,文字没有显示出来。为什么?我该如何解决这个问题?
修改FIX:
case R.id.edit:
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.editvslayout,
null);
final EditText evsname = (EditText) textEntryView
.findViewById(R.id.vsname);
final EditText evsdesc = (EditText) textEntryView
.findViewById(R.id.vsdesc);
evsdesc.setText(folderdesc);
evsname.setText(foldername);
new AlertDialog.Builder(this)
.setTitle(
Messages.getString("OSListActivity.52") + item_cursor.getString(1)) //$NON-NLS-1$
.setView(textEntryView)
.setPositiveButton(Messages.getString("OSListActivity.53"), //$NON-NLS-1$
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
// code here
}