I\'m new with android.
Currently I want to show an AlertDialog
box with \'OK\' & \'Cancel\' buttons.
The default is PositiveButton: Left, Ne
I have figured out that there is a space layout between the neutral button
and -ve/+ve buttons
with the place "1" in the buttonBarLayout
in which the buttons.
So, at first we need to remove that space and or make it's visibility GONE
(invisible
will let it still takes a space in the buttonBarLayout
) also we better to use method onShowListner better that doing that after showing the dialog by:
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
LinearLayout view = (LinearLayout) neutralButtonOrAnyOtherBtnFromThe3Btns.getParent();
Space space= (Space) view.getChildAt(1);
}
});
then the rest is your design, wish that helps