我在Android的新的東西,所以要耐心。 我想實現一個簡單的應用程序與 一個輸入文本的按鈕來獲取圖片來自谷歌 (對於第2版從閃爍以及:)) ,並把它們在網格中。 我下面 http://developer.android.com/resources/tutorials/views/hello-gridview.html 從哪裏獲得的靜態圖像,但我不知道 動態地實現它。 你能否給我一個暗示來實施研究並建立網格?如何從谷歌獲取圖片?
1
A
回答
1
首先聲明的String []在這樣
String[] mStrings={
"http://a3.twimg.com/profile_images/670625317/aam-logo-v3-twitter.png",
"http://a3.twimg.com/profile_images/740897825/AndroidCast-350_normal.png",
"http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
"http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
"http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
"http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
"http://a1.twimg.com/profile_images/841338368/ea-twitter-icon.png",
"http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
"http://a1.twimg.com/profile_images/850960042/elandroidelib
"http://a1.twimg.com/profile_images/655119538/andbook.png",
"http://a3.twimg.com/profile_images/768060227/ap4u_normal.jpg",
"http://a1.twimg.com/profile_images/74724754/android_logo_normal.png"};
主類,然後把這個字符串[]到適配器數據
gridview=(GridView)findviewById(R.id.gridview);
adapter=new LazyAdapter(this, mStrings);
gridview.setAdapter(adapter);
這樣的適配器
public class LazyAdapter extends BaseAdapter {
private Activity activity;
private String[] data;
private static LayoutInflater inflater=null;
public ImageLoader imageLoader;
public LazyAdapter(Activity a, String[] d) {
activity = a;
data=d;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return data.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.item, null);
TextView text=(TextView)vi.findViewById(R.id.text);;
ImageView image=(ImageView)vi.findViewById(R.id.image);
text.setText("item "+position);
imageLoader.DisplayImage(data[position], activity, image);
return vi;
}
}
2
我認爲你需要實現以下鏈接谷歌搜索Api.see供參考:
+1
如何使用該API,並且可以在Java中執行此操作? – 2014-10-17 06:33:49
相關問題
- 1. 如何獲取谷歌圖片
- 2. 如何從iOS中的谷歌地圖獲取靜態圖片
- 3. 如何從谷歌地圖v2的視圖中獲取片段
- 4. 如何抓取谷歌網頁圖片
- 5. 獲取谷歌圖片URL開車
- 6. 使用htmlagilitypack來獲取谷歌圖片
- 7. 如何獲取您的圖片網址磁貼? (谷歌地圖)
- 8. 如何獲得像谷歌圖片搜索「谷歌圖片搜索」
- 9. 如何從谷歌圖片搜索
- 10. 無法獲取位圖從谷歌個人資料圖片url
- 11. 從谷歌下降圖片
- 12. 如何獲取我的位置谷歌圖片?
- 13. 如何在谷歌圖片搜索api v2中獲取圖片url
- 14. 將圖片上傳到谷歌雲後,如何獲取該圖片的鏈接?
- 15. 如何從谷歌圖片搜索下載1000張圖片
- 16. 如何從谷歌視頻中提取圖片?
- 17. 從選定的谷歌圖表切片中獲取數據PieChart
- 18. 使用javascript從谷歌驅動器api獲取圖片
- 19. 從谷歌飼料中獲取圖片API
- 20. 如何從谷歌api獲取谷歌組數據
- 21. 如何從谷歌聯繫人API獲取谷歌聯繫人?
- 22. 谷歌餅圖從MySQL獲取數據
- 23. Android:從谷歌地圖獲取路線
- 24. 從谷歌獲取第一幅圖像
- 25. 從谷歌地圖獲取經緯度
- 26. 使用dom從谷歌獲取圖像
- 27. 從谷歌地圖獲取多邊形
- 28. 從谷歌地圖獲取評論api
- 29. 從xml谷歌地圖獲取數據
- 30. 從place_id獲取谷歌地圖鏈接
在Google中搜索文本的部分在哪裏? – 2014-10-11 10:05:50