您好我创建了一个应用程序,因为我使用自定义适配器在Web view
中获得了Grid view
。
那么如何使Web view
可点击?
我的代码是:使用这个我觉得GridView
Screen_Shot_Custom_Adapter adapter = new Screen_Shot_Custom_Adapter(getApplicationContext(), screenshotList);
gridView.setAdapter(adapter);
Screen_Shot_Custom_Adapter.java文件是:
public View getView(int position, View convertView, ViewGroup parent)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View vi=convertView;
if (convertView == null)
{
vi = inflater.inflate(R.layout.screen_shot_item, null);
vholder = new ViewHolder();
vholder.t1 = (TextView) vi.findViewById(R.id.textView_screen_shot);
vholder.img=(WebView)vi.findViewById(R.id.webView_screen_Shot);
vi.setTag(vholder);
}
else
vholder = (ViewHolder) (vi.getTag());
System.out.println("GridItems:"+gridViewItems);
vholder.t1.setText(gridViewItems.get(position).get("time"));
WebSettings settings = vholder.img.getSettings();
settings.setUseWideViewPort(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
vholder.img.loadUrl(gridViewItems.get(position).get("url"));
return vi;
}
static class ViewHolder
{
TextView t1;
WebView img;
}