我正在尝试为我的活动设置一个自定义标题(使用requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);),并设置一个自定义标题高度。我有我的自定义风格和主题都设置好了。只要我的主题继承自android:Theme,一切都很好。它获得自定义背景,自定义标题栏高度,一切如预期。但是,如果我的自定义主题继承自android:Theme.Dialog,那么它将拒绝使用我的自定义标题栏高度。它只是停留在大约25px左右。(这很奇怪,因为在添加任何自定义标题之前,默认标题栏大约是50px )。
有没有办法在对话框上设置自定义标题?
发布于 2011-05-05 13:29:54
为什么不创建自定义对话框呢?希望这能有所帮助
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.maindialog);//this will get the custom dialgo layout
dialog.setTitle("Here is your custom title");
dialog.setCancelable(true);
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//custom dialog has been created. Time to show
dialog.show()https://stackoverflow.com/questions/5892854
复制相似问题