开发者

GridView get row and Column

开发者 https://www.devze.com 2023-04-11 04:52 出处:网络
Is that any way to get the row and column number of the clicked cell in GridView (Android)? public void onItemClick(AdapterView parent,

Is that any way to get the row and column number of the clicked cell in GridView (Android)?

public void onItemClick(AdapterView parent, 
       开发者_运维技巧 View v, int position, long id) 
        {   
            int row_no=position/MAX_COL;
            int col_no=position%MAX_COL;
            Toast.makeText(getBaseContext(), 
                    "pic" + (position + 1) + " selected" + "ID" + id, 
                    Toast.LENGTH_SHORT).show();

        }

I'm using this but is there any way to directly get the row, col no

0

精彩评论

暂无评论...
验证码 换一张
取 消