간단하게 그림을 볼수 있는 앱 개발중입니다


인터넷에서 정보를 얻어 대략 틀을 잡고 만들었는데요..


아래쪽에 갤러리뷰가 있고 갤러리뷰 사진을 스크롤하면 ImageSwitcher 를 이용해 화면에 큰화면에 뜨게햇는데.


갤러리뷰를 스크롤을 해야만 사진이 변경이 되는데요..


    

         gallery.setAdapter(new GalleryAdapter(this));

        gallery.setSelection(images.length);

        gallery.setOnItemSelectedListener(new OnItemSelectedListener() {

public void onItemSelected(AdapterView<?> parent, View view,

int position, long id) {

is.setImageResource(images[position%images.length]);

}

public void onNothingSelected(AdapterView<?> parent) {

}

});

       

        is.setFactory(new ImageFactory(this));

     

        is.setInAnimation(AnimationUtils.loadAnimation(this,

                android.R.anim.fade_in));

        is.setOutAnimation(AnimationUtils.loadAnimation(this,

                android.R.anim.fade_out));


    }

   

    private class GalleryAdapter extends BaseAdapter{

    private Context context;

public GalleryAdapter(Context context) {

this.context = context;

}

public int getCount() {

return Integer.SIZE;

}

public Object getItem(int position) {

return null;

}

public long getItemId(int position) {

return position;

}

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

ImageView iv = new ImageView(context);

iv.setImageResource(images[position%images.length]);

iv.setLayoutParams(new Gallery.LayoutParams(200,200));

iv.setAdjustViewBounds(true);

return iv;

}

    }

   

    private class ImageFactory implements ViewFactory{

    private Context context;

    public ImageFactory(Context context){

    this.context = context;

    }

    public View makeView() {

ImageView iv = new ImageView(context);

iv.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

return iv;

}

    }




위쪽 큰화면도 스크롤을 하게되면....


갤러리뷰 처럼 이미지가 변하게 할려면 어떻게 해야될까요....