我想重新设计我的警报对话框(以更改此对话框的窗口)。我试图在网上搜索,我没有找到有用的东西。我还尝试为警报对话框设置布局,但我没有找到执行此操作的系统...我是 Android 的初学者。我的代码:
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.app.Activity;
import android.app.AlertDialog;
import android.view.View.OnClickListener;
public class Magie extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.magie);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
final Button magie1 = (Button) findViewById(R.id.bma1);
magie1.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
magie1();
}
});
final Button magie2 = (Button) findViewById(R.id.bma2);
magie2.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
magie2();
}
});
final Button magie3 = (Button) findViewById(R.id.bma3);
magie3.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
magie3();
}
});
final Button magie4 = (Button) findViewById(R.id.bma4);
magie4.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
magie4();
}
});
}
private void magie1(){
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("title1");
ad.setMessage("text1");
ad.show();
}
private void magie2(){
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("title2");
ad.setMessage("text2");
ad.show();
}
private void magie3(){
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("title3");
ad.setMessage("text3");
ad.show();
}
private void magie4(){
AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("title4");
ad.setMessage("Text4");
ad.show();
}
}