[英]PreferenceScreen: How can I set setDisplayHomeAsUpEnabled and custom icon?
My current PreferenceActivity displays the HomeAsUp icon in the top left corner (I have not to explain you this left carret ;-) ) 我当前的PreferenceActivity在左上角显示HomeAsUp图标(我不必向您解释这个左角;-))
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
this.getSupportActionBar().setIcon(R.drawable.ic_menu_preferences);
The big problems come when I use a "subpreference" screen like this: 当我使用如下所示的“子首选项”屏幕时,就会出现大问题:
<PreferenceCategory android:title="Detail Screens">
<PreferenceScreen
android:title="My Preference Screen"
android:summary="The icon is sown in this page and that's great">
<CheckBoxPreference
android:title="This is an other screen"
android:summary="Unfortunately, no custom icon or HomeAsUp here!."
/>
</PreferenceScreen>
In the second screen, the default icon is shown with the the default title. 在第二个屏幕中,显示带有默认标题的默认图标。 How can I programatically set the icon and HomeAsUp? 如何以编程方式设置图标和HomeAsUp?
I know I could create a second Activity (and that's what I plan to do if no answer) but it would really be better if I could keep only one preference screen. 我知道我可以创建第二个活动(如果没有答案,这就是我打算做的事情),但是如果我只保留一个首选项屏幕,那会更好。
Any idea // suggestion? 任何想法//建议吗?
That's an Android bug! 这是一个Android错误!
https://code.google.com/p/android/issues/detail?id=4611 https://code.google.com/p/android/issues/detail?id=4611
Sounds like I have to start a new Activity! 听起来我必须开始一个新的活动!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.