我想搬到其他班级.. 点击膨胀的视图时。
这是来源......
LayoutInflater inflater = (LayoutInflater)screen.getSystemService(screen.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.log_viewer, null);
AlertDialog.Builder builder = new AlertDialog.Builder(Log_Activity.this);
builder.setView(layout);
AlertDialog alertDialog = builder.create();
alertDialog.show();
Button chat = (Button)findViewById(R.id.Chat);
chat.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(Log_Activity.this,Text_chat.class);
startActivity(i);
}
}) ;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
Window window = alertDialog.getWindow();
lp.copyFrom(window.getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
按下按钮后,它突然崩溃。 有人可以帮帮我吗?