I'd just make your own custom class to simulate an AlertDialog, this way you can use your own layout with no strings attached. (There are some weird issues where you can't fully get rid of the frame if you want a fully styled AlertDialog). Something like this, but you can expand this as fully as you want:
public class CustomDialog extends Dialog {
private Button positive, negative;
public CustomDialog(Context context) {
super(context);
initialize(context);
}
protected CustomDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
initialize(context);
}
public CustomDialog(Context context, int theme) {
super(context, theme);
initialize(context);
}
private void initialize(Context c) {
//Inflate your layout, get a handle for the buttons
positive = (Button)layout.findViewById(R.id.positive):
negative = (Button)layout.findViewById(R.id.negative):
positive.setVisibility(View.GONE);
negative.setVisibility(View.GONE);
}
public void setPositiveButton(String buttonText, View.OnClickListener listener) {
positive.setText(buttonText);
positive.setOnClickListener(listener);
positive.setVisibility(View.VISIBLE);
}
public void setNegativeButton(String buttonText, View.OnClickListener listener) {
negative.setText(buttonText);
negative.setOnClickListener(listener);
negative.setVisibility(View.VISIBLE);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…