ANDROID:使用轨迹球和触摸时突出显示/选择

发布于 2024-09-30 14:25:52 字数 540 浏览 0 评论 0原文

我的 Android 应用程序当前有 TableLayout 和几个包含 ImageViewTableRow,然后是 TextView并排。

单击 TableRow 上的任意位置将加载一个显示更多信息的新活动。

如果我使用轨迹球,它将在行中工作,但我看不到当前选择的是哪一个,因此当我单击按钮加载 时,不知道选择了哪个 TableRow >活动

同样,当用户用手指触摸屏幕时,也不会突出显示他们选择了哪一个。

我已经使用诸如突出选定焦点等术语进行搜索,但我看到返回的页面都没有给我任何关于实现的见解我需要什么。

我猜需要使用 TableLayout ,这正是我所使用的,甚至可能不是最好的解决方案!

有什么例子我可以尝试让它工作吗?

谢谢! :)

My Android application currently has TableLayout with several TableRows 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰雪之触 2024-10-07 14:25:52

您需要使用选择器,例如您有一些视图可以保存行的视图,然后您需要像这样创建选择器

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/list_viewentry_focused" />
    <item android:state_pressed="true" android:drawable="@drawable/list_viewentry_pressed" />
    <item android:drawable="@drawable/list_viewentry_normal" />
</selector>

并将其放入您的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

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/list_viewentry_focused" />
    <item android:state_pressed="true" android:drawable="@drawable/list_viewentry_pressed" />
    <item android:drawable="@drawable/list_viewentry_normal" />
</selector>

and put it in your drawables folder

then you need to set android:background @drawable/drawable_name

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文