<small id='KzVMV'></small><noframes id='KzVMV'>

      <bdo id='KzVMV'></bdo><ul id='KzVMV'></ul>
    <legend id='KzVMV'><style id='KzVMV'><dir id='KzVMV'><q id='KzVMV'></q></dir></style></legend>

    1. <tfoot id='KzVMV'></tfoot>

      1. <i id='KzVMV'><tr id='KzVMV'><dt id='KzVMV'><q id='KzVMV'><span id='KzVMV'><b id='KzVMV'><form id='KzVMV'><ins id='KzVMV'></ins><ul id='KzVMV'></ul><sub id='KzVMV'></sub></form><legend id='KzVMV'></legend><bdo id='KzVMV'><pre id='KzVMV'><center id='KzVMV'></center></pre></bdo></b><th id='KzVMV'></th></span></q></dt></tr></i><div id='KzVMV'><tfoot id='KzVMV'></tfoot><dl id='KzVMV'><fieldset id='KzVMV'></fieldset></dl></div>

        GridView 在触摸时获取项目

        时间:2024-08-24
        • <i id='stRFe'><tr id='stRFe'><dt id='stRFe'><q id='stRFe'><span id='stRFe'><b id='stRFe'><form id='stRFe'><ins id='stRFe'></ins><ul id='stRFe'></ul><sub id='stRFe'></sub></form><legend id='stRFe'></legend><bdo id='stRFe'><pre id='stRFe'><center id='stRFe'></center></pre></bdo></b><th id='stRFe'></th></span></q></dt></tr></i><div id='stRFe'><tfoot id='stRFe'></tfoot><dl id='stRFe'><fieldset id='stRFe'></fieldset></dl></div>
        • <small id='stRFe'></small><noframes id='stRFe'>

          <legend id='stRFe'><style id='stRFe'><dir id='stRFe'><q id='stRFe'></q></dir></style></legend>
          • <bdo id='stRFe'></bdo><ul id='stRFe'></ul>

              <tbody id='stRFe'></tbody>
                <tfoot id='stRFe'></tfoot>

                  本文介绍了GridView 在触摸时获取项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试图在触摸 gridview 时选择项目,但我无法使用 onClick,因为它会启动另一个活动.我想要实现的是能够在网格视图中移动项目,因为我找不到这样做的方法,所以我正在尝试一种方法..

                  I'm trying to get the item selected when i touch a gridview, i cant use the onClick as that starts another activity. What I'm trying to achieve is to be able to move items in a gridview around and since i cant find a way of doing it I'm trying to make a way..

                  所以是的.. 有没有办法让哪个项目被触摸",我尝试使用 Rect 但它没有正常工作..

                  So yeah.. Is there a way to get which item has been 'touched', I've tried using a Rect and it hasn't worked properly..

                  (我能详细说明一下吗..我不能为此使用 onItemClick..)

                  (Can i just elaborate.. i Cant use the onItemClick for this..)

                  任何帮助都会很棒,谢谢!:)

                  Any help would be great, Thank you! :)

                  推荐答案

                  如果 Glendon Trullinger 的使用 onLongClickListener 的建议对你来说还不够,试试 GridView#pointToPosition(int x, int y),您可以从 View.OnTouchListener,使用 MotionEvent 的 x 和 y 坐标.使用该位置,您可以使用 获取该位置的子视图这个答案,和/或您可以使用 AdapterView#getItemAtPosition(int)

                  If Glendon Trullinger's suggestion of using onLongClickListener isn't sufficient for you, try GridView#pointToPosition(int x, int y), which you can call from a View.OnTouchListener, using the MotionEvent's x and y coordinates. With that position, you can get the child view at that position using this answer, and/or you can get the adapter item itself using AdapterView#getItemAtPosition(int)

                  这篇关于GridView 在触摸时获取项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:创建一个多彩多姿的板 下一篇:Vaadin Grid 单元格未显示多行行

                  相关文章

                  1. <small id='mwkiS'></small><noframes id='mwkiS'>

                    <legend id='mwkiS'><style id='mwkiS'><dir id='mwkiS'><q id='mwkiS'></q></dir></style></legend>

                    <tfoot id='mwkiS'></tfoot>

                      <i id='mwkiS'><tr id='mwkiS'><dt id='mwkiS'><q id='mwkiS'><span id='mwkiS'><b id='mwkiS'><form id='mwkiS'><ins id='mwkiS'></ins><ul id='mwkiS'></ul><sub id='mwkiS'></sub></form><legend id='mwkiS'></legend><bdo id='mwkiS'><pre id='mwkiS'><center id='mwkiS'></center></pre></bdo></b><th id='mwkiS'></th></span></q></dt></tr></i><div id='mwkiS'><tfoot id='mwkiS'></tfoot><dl id='mwkiS'><fieldset id='mwkiS'></fieldset></dl></div>
                        <bdo id='mwkiS'></bdo><ul id='mwkiS'></ul>