ANDROID:使用轨迹球和触摸时突出显示/选择
我的 Android
应用程序当前有 TableLayout
和几个包含 ImageView
的 TableRow
,然后是 TextView
并排。
单击 TableRow
上的任意位置将加载一个显示更多信息的新活动。
如果我使用轨迹球,它将在行中工作,但我看不到当前选择的是哪一个,因此当我单击按钮加载 时,不知道选择了哪个
。TableRow
>活动
同样,当用户用手指触摸屏幕时,也不会突出显示他们选择了哪一个。
我已经使用诸如突出、选定、焦点等术语进行搜索,但我看到返回的页面都没有给我任何关于实现的见解我需要什么。
我猜需要使用 TableLayout
,这正是我所使用的,甚至可能不是最好的解决方案!
有什么例子我可以尝试让它工作吗?
谢谢! :)
My Android
application currently has TableLayout
with several TableRow
s containing an ImageView
then TextView
side-by-side.
Clicking any where on a TableRow
will load a new activity showing further info.
If I use the trackball, it will work its way through the rows, but I don't see which is currently selected so have no idea which TableRow
is selected when I click the button to load the activity
.
Likewise, when a user touches the screen with a finger, there is no highlight showing which one they selected.
I've searched with terms such as Highlight, Selected, Focus, but none of the pages I see returned have given me any insight into achieving what I require.
Using a TableLayout
is required I guess, it was just what I used and may not even be the best solution!
Any examples out there I can try to get this working??
Thanks! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用选择器,例如您有一些视图可以保存行的视图,然后您需要像这样创建选择器
并将其放入您的drawables文件夹中
,然后您需要设置 android:background @drawable/drawable_name< /代码>
You need to use selectors, for instance you have some view which holds view of you row, then you need to create selector like this
and put it in your drawables folder
then you need to set
android:background @drawable/drawable_name