PreferenceActivity 在 Honeycomb 上缺少图标
我创建了一个包含 ListActivity 的简单 PreferenceActivity。 (为了完整起见,在末尾添加了代码),但它在 2.3 设备和 Galaxy Tab 10.1" (Android 3.2) 上的显示有所不同(参见下图)。
我的问题是:
- 我还可以获取带有向右箭头的图标吗?蜂窝状?
- 我可以避免活动标题和 ListPreference 之间的空黑线
public class TestPreference extends PreferenceActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setPreferenceScreen(createPreferenceHierarchy());
}
private PreferenceScreen createPreferenceHierarchy()
{
// Root
PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
/*
* select language
*/
ListPreference listPref = new ListPreference(this);
listPref.setKey("Language");
listPref.setEntries(new String[]{"eng", "fra"});
listPref.setEntryValues(new String[]{"eng", "fra"});
listPref.setValue("eng");//TODO: assumes English is a supported language!?
listPref.setSummary("You can select your language here");
listPref.setTitle("Select Language");
root.addPreference(listPref);
return root;
}
}
I've created a simple PreferenceActivity containing a ListActivity. (code added at the end for completeness) but it shows up differently on a 2.3 device and on a Galaxy Tab 10.1" (Android 3.2) (see images below).
My questions are:
- Can I also get the icon with the right arrow in Honeycomb?
- Can I avoid the empty black line between the title of the activity and the ListPreference
public class TestPreference extends PreferenceActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setPreferenceScreen(createPreferenceHierarchy());
}
private PreferenceScreen createPreferenceHierarchy()
{
// Root
PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
/*
* select language
*/
ListPreference listPref = new ListPreference(this);
listPref.setKey("Language");
listPref.setEntries(new String[]{"eng", "fra"});
listPref.setEntryValues(new String[]{"eng", "fra"});
listPref.setValue("eng");//TODO: assumes English is a supported language!?
listPref.setSummary("You can select your language here");
listPref.setTitle("Select Language");
root.addPreference(listPref);
return root;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论