1
我目前正在尝试有一个AlertDialog框弹出与自定义布局文件“details.xml”的电影信息我觉得这可能是我在AlertDialog方面填充这些字段,但我不确定如何最好地处理它。RequestFeature必须在添加内容之前调用,不确定为什么它被称为
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> Parent, View view, int position,
long id) {
// TODO Auto-generated method stub
Movie mTemp = movieArray.get(position);
//Intent intent = new Intent(getApplicationContext(), SingleItemList.class);
AlertDialog.Builder builder = new AlertDialog.Builder(MovieList.this);
builder.setView(getLayoutInflater().inflate(R.layout.details, null));
builder.setTitle("Details");
builder.setNeutralButton("Post to Facebook", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked OK button
}
});
AlertDialog d = builder.create();
if (mTemp != null) {
ImageView image = (ImageView) d.findViewById(R.id.detailIcon);
TextView title = (TextView) d.findViewById(R.id.detailTitle);
TextView year = (TextView) d.findViewById(R.id.detailYear);
TextView rating = (TextView) d.findViewById(R.id.detailRating);
TextView director = (TextView) d.findViewById(R.id.detailDirector);
if (title != null) {
title.setText("Name: " + mTemp.title);
}
if(year != null) {
year.setText("Year: " + mTemp.year);
}
if(rating != null) {
rating.setText("Rating: " + mTemp.rating + "/10");
}
if(director != null) {
director.setText("Director: " + mTemp.director);
}
if(image != null) {
image.setImageBitmap(getBitmap(mTemp.coverURL));
}
}
d.show();
/*
Dialog dialog = new Dialog(MovieList.this);
dialog.setTitle("Details");
dialog.setContentView(R.layout.details);
dialog.show();*/
}
});
你的代码中requestFeature被调用的地方在哪里? –
我从来没有打过电话,刚开始显示错误时,我开始添加AlertDialog – Ryan
然后你怎么确定它被调用? Android底层系统可能会调用某些方法,因为这就是android的工作原理。对话框需要请求一个窗口在其他事物中没有标题。请详细说明你的问题,它非常含糊。你想要处理什么?你真正的问题是什么? –