如何同时拥有自定义标题栏和TabWidget?
我有一个名为 TabWidget
的程序,它调用不同的活动。问题是,当我调用一个已经有自己的自定义标题栏的类时,它会崩溃并给出错误 java.lang.RuntimeException
:
Unable to start activity ComponentInfo{com.cellphone/com.cellphone.Settings}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
如何解决这个问题?我想要一个 Android 版本的 iPhone 菜单栏(这就是我使用 TabWidget
的原因),并且每个页面上都有自己的自定义标题栏。
编辑:在我的页面上,我使用自定义标题
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.imtrackinglayout);
this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.custom_title_3);
我的程序在 requestWindowFeature 行上崩溃,并出现上述错误。
I have a program that is a TabWidget
that calls different activities. The problem is it crashes when I call a class that already has its own custom title bar and gives me the error java.lang.RuntimeException
:
Unable to start activity ComponentInfo{com.cellphone/com.cellphone.Settings}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
How do you get around this problem? I want an android version of iPhone's menu bar (which is why I'm using the TabWidget
) that also has its own custom title bar on every page.
EDIT: on my pages I'm using a custom title
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.imtrackinglayout);
this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.custom_title_3);
My program crashes on the requestWindowFeature line with the above error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试从 theme.xml 中删除 item name="android:windowNoTitle">true。
这应该可以解决你的问题。
Try deleting item name="android:windowNoTitle">true from theme.xml.
That should fix your issue.