GridView Android Studio-onHover?

问题描述

我想对我的gridView实现一种onHover。 这是我当前的代码

var request = require('request');
var fs = require('fs');
var http = require('follow-redirects').http;
var axios = require('axios');

var options = {
  'method': 'POST','url': 'http://azcaptcha.com/in.PHP?key=key&method=post','headers': {
  },formData: {
    'file': {
      'value': fs.createReadStream('C:/Users/jsonx/Documents/fiverr/captchatest.png'),'options': {
        'filename': 'C:/Users/jsonx/Documents/fiverr/captchatest.png','contentType': null
      }
    }
  }
};

//let respondedID;
convertToInt = (x) => {
    var converted=parseInt(x[1],10); 
    return converted;
} 

request(options,function (error,response) {
  if (error) throw new Error(error);
  var respondedID = response.body;
  console.log('line 26 '+respondedID);
  chainResolve(respondedID);

});


chainResolve = (id) => {
    var sid = id.split('|');
    var resolvedID=parseInt(sid[1],10)
    console.log(parseInt(sid[1],10));
    console.log('line 40 '+convertToInt(sid));

    var config = {
      method: 'get',url: 'http://azcaptcha.com/res.PHP?key=key&action=get&id=resolvedID',headers: { }
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
}

这给了我以下观点:

enter image description here

所以我希望当鼠标放在网格上时,网格中每个单元格的背景都将改变。 有可能吗?

解决方法

GridView没有用于悬停事件的侦听器。建议您切换为使用RecyclerView并在视图持有者上调用setOnHoverListener。以下链接应有帮助:

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...