2011-12-06 59 views
0

我有自定義網頁瀏覽量的畫廊。我的適配器:如何放大畫廊?

public class AddImgAdp extends BaseAdapter { 
    int GalItemBg; 
    private Context cont; 

    public AddImgAdp(Context c) { 
     cont = c; 
     TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme); 
     GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0); 
     typArray.recycle(); 
    } 

    public int getCount() { 
     return pagesArray.length; 
    } 

    public Object getItem(int position) { 
     return pagesArray[position]; 
    } 

    public long getItemId(int position) { 
     return position; 
    } 

    public View getView(int position, View convertView, ViewGroup parent) { 

     final WebView wView = pagesArray[position]; 
     if(wView!=null){ 
      if(wView.loaded==0){ 
       wView.setInitialScale(50); 
       wView.getSettings().setJavaScriptEnabled(true); 
       wView.getSettings().setSupportZoom(false); 
       wView.getSettings().setBuiltInZoomControls(false); 
       wView.getSettings().setUseWideViewPort(true); 
       wView.setPadding(0, 0, 0, 0); 

       wView.setWebViewClient(new WebViewClient() { 
        @Override 
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){ 
         super.onReceivedError(view, errorCode, description, failingUrl); 
        } 

        @Override 
        public boolean shouldOverrideUrlLoading(WebView view, String url){ 
         view.loadUrl(url); 
         return true; 
        } 

        @Override 
        public void onPageFinished(WebView view, String url){ 
         wView.loaded = 1; 
        } 

       }); 

       wView.loadUrl(URL_TO_LOAD); 
       wView.setBackgroundResource(GalItemBg); 
       Gallery.LayoutParams params = new Gallery.LayoutParams(400, 430); 
       wView.setLayoutParams(params); 
      } 
     } 
     return wView; 

    } 

} 

而且,如何以這樣一種方式實現放大畫廊中的所有整體會增加/減少?

+0

我在[這裏]發佈的示例代碼的鏈接[1],希望它可以幫助 [1]:http://stackoverflow.com/questions/10268806/android-gallery -with捏縮放 –

回答

1

沒有任何功能允許您使用imageview或圖庫進行此操作。

但是,這裏是一個很好的教程,讓你在路上。

Pinch zoom