我是android开发的新手。我想要一个带有 edittExt 的多选对话框。我不想创建 ant row.xml。我想在我的多选对话框中添加动态编辑文本。我不知道该怎么做......如果有人可以帮助我......我的多选对话框代码是......
public class MultiSelectionDialogExample extends Activity
{
protected CharSequence[] _options = { "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" };
protected boolean[] _selections = new boolean[ _options.length ];
protected Button _optionsButton;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_optionsButton = ( Button ) findViewById( R.id.button );
_optionsButton.setOnClickListener( new ButtonClickHandler() );
}
public class ButtonClickHandler implements View.OnClickListener {
public void onClick( View view ) {
showDialog( 0 );
}
}
@Override
protected Dialog onCreateDialog( int id )
{
return
new AlertDialog.Builder( this )
.setTitle( "Planets" )
.setMultiChoiceItems( _options, _selections, new DialogSelectionClickHandler() )
.setPositiveButton( "OK", new DialogButtonClickHandler() )
.create();
}
public class DialogSelectionClickHandler implements DialogInterface.OnMultiChoiceClickListener
{
public void onClick( DialogInterface dialog, int clicked, boolean selected )
{
Log.i( "ME", _options[ clicked ] + " selected: " + selected );
}
}
public class DialogButtonClickHandler implements DialogInterface.OnClickListener
{
public void onClick( DialogInterface dialog, int clicked )
{
switch( clicked )
{
case DialogInterface.BUTTON_POSITIVE:
printSelectedPlanets();
break;
}
}
}
protected void printSelectedPlanets(){
for( int i = 0; i < _options.length; i++ ){
Log.i( "ME", _options[ i ] + " selected: " + _selections[i] );
}
}
}
如何在此对话框的每一行中添加编辑文本...请大家告诉我解决问题的正确方法...