我有这个对话框类,我想将图标设置为它的标题:
public class DialogMealInformation extends Dialog implements
android.view.View.OnClickListener {
Context context;
private TextView tv_information;
private Button b_ok;
private String information;
public DialogMealInformation(Context context, String information) {
// TODO Auto-generated constructor stub
super(context);
this.context = context;
this.information = information;
setContentView(R.layout.dialog_meal_information);
getWindow().setLayout(android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
setTitle("Info !");
initialize();
}
它试过这样:
setTitle(R.layout.dialog_simple_header);
dialog_simple_header.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_dialog_simple_header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tv_information"
android:drawableLeft="@drawable/more_information" />
</LinearLayout>
但之后的标题是“res/layout/dialog_simple_header.x”只是文本,没有出现图标,请问为什么,解决方案是什么,非常感谢