开发者

Android how to use webview with galleryview

I want to a galleryview what its' items as webview. So i am not wanting sc开发者_如何学Crolling image, i want to scroll webviews.. Please help. I make some things but webview doesnt run correct into gallery.


You have to use custom Adapter for your gallery view and then override getView method. Something like this:

    public class CustomGalleryAdapter extends BaseAdapter

and then

    @Override
    public View getView(int position, View convertView, ViewGroup parent) 
    {
        View view = convertView;
        if (view == null)
        {
            LayoutInflater vi = (LayoutInflater)activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
            view = vi.inflate(R.layout.YOUR_WEBVIEW_LAYOUT, null);
        }
        // Here do some changes to webview view
        // view.SetXY()...

        return view;
    }

and configure your gallery view with new adapter:

    gallery.setAdapter(new CustomGalleryAdapter(...));

The YOUR_WEBVIEW_LAYOUT is a layout created in layout resources, which may contain also only a single webview.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜