android 无法设置窗口图标
如何为所有活动设置窗口图标。我已经了解了窗口功能和设置功能的相关方法。
这是我用来设置图标的代码:
requestWindowFeature(Window.FEATURE_LEFT_ICON);
setContentView(R.layout.main);
setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon);
我在活动的“onCreate”方法中调用了此代码。图标是为主要活动设置的。但每当我去其他活动时,窗口中都没有设置图标。我在 logcat 中看不到任何错误。请帮我。
How can I set a window icon for all the activities. I have gone through the window features and relative methods to set the features.
Here is the code I have used to set the icon:
requestWindowFeature(Window.FEATURE_LEFT_ICON);
setContentView(R.layout.main);
setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon);
I have called this code in the 'onCreate' method of an activity. Icon is set for the main activity. But whenever I go to other activities, no icon is set in the window. I cannot see any errors in the logcat. Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个缓存问题:)
我已经从模拟器中卸载了该应用程序,并从“bin”文件夹中删除了以下文件:
删除了 R.java 文件。
重新安装应用程序后,它完美运行。
It was a cache problem :)
I have Uninstalled the application from the emulator and deleted the following files from the 'bin' folder:
Deleted the R.java file.
It worked perfectly after reinstalling the application.