Jam*_*ing 2 java android android-alertdialog
我正在尝试调整我之前做过的AlertDialog,但是不记得我是怎么做到的.下面是我使用的代码,但它只是工作.是否有人能够指出我做错了什么.
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
alertDialogBuilder
.setMessage(R.string.checkout_journey_selector_popup_title)
.setPositiveButton(R.string.checkout_journey_selector_popup_paylater_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
CheckoutHelper.startReservationJourney(getActivity(),
collectibleItems);
}
})
.setNegativeButton(R.string.checkout_journey_selector_popup_paynow_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
CheckoutHelper.startPrepayCollectionJourney(getActivity(),
collectibleItems);
}
}).create().show();
Dialog alert = alertDialogBuilder.create();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(alert.getWindow().getAttributes());
lp.height = 100;
lp.width = 50;
alert.getWindow().setAttributes(lp);
Run Code Online (Sandbox Code Playgroud)
提前致谢
你应该替换它
Dialog alert = alertDialogBuilder.create();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(alert.getWindow().getAttributes());
lp.height = 100;
lp.width = 50;
alert.getWindow().setAttributes(lp);
Run Code Online (Sandbox Code Playgroud)
同
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(alertDialogBuilder.getWindow().getAttributes());
lp.height = 100;
lp.width = 50;
alertDialogBuilder.getWindow().setAttributes(lp);
Run Code Online (Sandbox Code Playgroud)
或试试这个
alertDialog.getWindow().setLayout(600, 400); after alertDialog.show();
Run Code Online (Sandbox Code Playgroud)
先试试并给我反馈
| 归档时间: |
|
| 查看次数: |
2343 次 |
| 最近记录: |