在用百度APIStore的天气接口时,
http://apistore.baidu.com.cn/apiworks/servicedetail/478.html
需要加一些参数,这里他要求在Headers字段里加入apikeyvolley里有什么现成的函数可以在headers里加参数啊??
初学volley,最初我在getParams()中加,发现好像不行。getParams()是不是不能再GET中用?

我用Postman以这样的形式是可以得到正确的结果。
PS:百度给的Demo没有用到volley。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这样:How to set custom header in Volley Request
其实很简单的 我帮你写了个简单的例子 你套着用吧:
StringRequest mStringRequest = new StringRequest(url, new Response.Listener<String>() {