我有我的游戏结果弹出标准AlertDialog,我想把它做大。 这是我创建对话框,并设置代码:如何更改标准警报对话框的大小并使其更大?
@Override
protected Dialog onCreateDialog(int id) {
adb = new AlertDialog.Builder(this);
win_lose_view = (RelativeLayout) getLayoutInflater().inflate(R.layout.win_lose_screen, null);
adb.setView(win_lose_view);
upper_text = (TextView) win_lose_view.findViewById(R.id.upper_text);
upper_text.setRotation(180);
lower_text = (TextView) win_lose_view.findViewById(R.id.lower_text);
upper_decide = (Button) win_lose_view.findViewById(R.id.upper_decide);
upper_decide.setRotation(180);
lower_decide = (Button) win_lose_view.findViewById(R.id.lower_decide);
Dialog d = adb.create();
d.setCanceledOnTouchOutside(false);
return d ;
}
@Override
protected void onPrepareDialog(int id, Dialog dialog){
super.onPrepareDialog(id, dialog);
upper_decide = (Button) win_lose_view.findViewById(R.id.upper_decide);
upper_decide.setRotation(180);
lower_decide = (Button) win_lose_view.findViewById(R.id.lower_decide);
};
if(first_player_points > second_player_points){
upper_text.setText("you win! score: " + first_player_points);
lower_text.setText("you lose! score: "+ second_player_points);
}
}
我想让它更广泛的 - 我该怎么做呢?
创建一个具有相同行为的对话框的自定义视图?在中心和黑暗背景下可以查看相对布局? –
你的意思是,没有使用任何标准的警报对话框?只是加载它在游戏结束? – ERJAN
是的。因为你问的对Google来说不是一个好习惯。该对话框具有可观察的最大尺寸。在你的情况下,它是exeptional。所以我认为你应该为此创建一个exerentnel行为。 –