如何在 Gingerbread & Honeycomb 上隐藏嵌套首选项的标题栏

How to hide titlebar of nested preference on Gingerbread & Honeycomb

我正在关注 this answer to construct settings of my application. My problem is that I get titlebar for nested PreferenceScreen elements. I tried to apply themes which turn off windowTitle. I tried to request window feature. But I was not successful. This problem is only on Gingerbread & Honeycomb. Post-Honeycomb everything works fine. Here is an image which shows two window titles one by me (this answer),系统关注另一个。

谁能帮我隐藏 window 设置的标题栏?我很确定它可以实现,但是 Whatsapp 开发人员不会回答我:)

最后我设法用

隐藏了标题栏
        View titleView = dialog.findViewById(android.R.id.title);
        if (titleView != null) {
            ((View)titleView.getParent()).setVisibility(View.GONE);
        }

根据 answer 中的 Gingerbread & Honeycomb 代码。好吧,if 条件代码可以写成 运行 仅在 Gingerbread & Honeycomb 上作为 post Honeycomb 我发现 titleView != null false.