Android 如何将对话框的标题颜色从白色更改为任何其他颜色
在我的代码Android 如何将对话框的标题颜色从白色更改为任何其他颜色,android,Android,在我的代码对话框2.setTitle(“反馈”)以白色显示。如何更改标题更改颜色?因为我的布局背景是白色的,所以我看不见。如何更改对话框标题颜色 public Dialog dialog2; ImageView b = (ImageView) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v)
对话框2.setTitle(“反馈”)代码>以白色显示。如何更改标题更改颜色?因为我的布局背景是白色的,所以我看不见。如何更改对话框标题颜色
public Dialog dialog2;
ImageView b = (ImageView) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog2 = new Dialog(context);
View vLoad = LayoutInflater.from(fifthscreen.this).inflate(R.layout.timer, null);
dialog2.setContentView(vLoad);
dialog2.setTitle("FeedBack");
dialog2.setCancelable(false);
dialog2.show();
}
});
}
////////////timer.xml///////////
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:id="@+id/layouttimer">
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textSize="15dp"
android:textColor="#000000" ></TextView>
<Button
android:id="@+id/FeedbackYummiSlice"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=" YumiiSlice" >
</Button>
<Button
android:id="@+id/FeedbackThisdish"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=" Feedback This dish " >
</Button>
<Button
android:id="@+id/nothanks"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text=" No,Thanks " >
</Button>
</LinearLayout>
公共对话框2;
ImageView b=(ImageView)findViewById(R.id.button1);
b、 setOnClickListener(新的OnClickListener(){
@凌驾
公共void onClick(视图v){
dialog2=新对话框(上下文);
View vLoad=LAYOUTINGFLATER.from(第五屏。此)。充气(R.layout.timer,null);
对话框2.setContentView(vLoad);
对话框2.设置标题(“反馈”);
对话框2.可设置可取消(false);
dialog2.show();
}
});
}
////////////timer.xml///////////
方法设置CustomTitle(查看customTitleView)
允许您这样做。您需要创建一个布局来设置此布局,并且在该布局中,只需将所需样式设置为TextView
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View customTitleView = inflater.inflate(R.layout.custom_title_view, null);
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setCustomTitle(customTitleView);
更多信息,请参阅。请参阅以下文章您提供了什么链接?无法理解I alrready创建视图检查此线视图vLoad=LayoutFlater.from(第五屏。此)。充气(R.layout.timer,null);并载入内容view@user2867267创建标题视图(TextView)并使用setCustomTitle进行设置。但问题是我没有使用Alert dailog im justing simple dialog检查我的代码也可以使用dialog进行设置。选中此项: