Android Swipe for older APIs

I could use http://developer.android.com/reference/android/support/v4/view/ViewPager.html but I need something much simplier like:
https://github.com/fry15/uk.co.jasonfry.android.tools. For my small static gallery there is only one tag in xml:


and in Java:

SwipeView sv = (SwipeView) findViewById(R.id.swipe_gallery);
ArrayList imagesList = (ArrayList) Cache.getInstance().readFromCache(GalleryService.IMAGES_CACHE_FORMAT);
if(imagesList != null) {
    for(HashMap imageData : imagesList) {
        Bitmap bitmap = BitmapUtils.fetchCachedImage((String) imageData.get("path"));
        ImageView imageView = new ImageView(this);
        imageView.setPadding(10, 8, 10, 10);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(250, 250);
        imageView.setLayoutParams(params);
        imageView.setImageBitmap(bitmap);
        imageView.setBackgroundResource(R.drawable.under_big_photo);
        LinearLayout layout = new LinearLayout(this);
        layout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
        layout.addView(imageView);
        sv.addView(layout);
    }
}

Comments are closed.

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress