如何在启动时默认选择 ListView 的第一项? [英] How to make the first item of a ListView to be selected as default at startup?

查看:24
本文介绍了如何在启动时默认选择 ListView 的第一项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 App 中有一个 ListView,ListView 有一个选择器.我想让这个 ListView 的第一项在启动应用程序默认被选中,如何?任何人都可以提供一些提示吗?非常感谢.

There is a ListView in my App and the ListView has a selector. I want to make the first item of this ListView to be selected as default at the very startup of App, How? Can anyone give some tips? THX a lot.

推荐答案

您可以通过

yourListView.setSelection(0);
yourListView.getSelectedView().setSelected(true);

希望对你有帮助

这篇关于如何在启动时默认选择 ListView 的第一项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆