Tuesday, 1 September 2015

How to Use Gallery for Scrolling Images with Page Indicator in Android

In this blog, I am explaining how to use Gallery for scrolling images with page indicator in android.
First of all you need to use a custom class in place of Gallery :-

  • package com.pakagename;
  • - See more at: http://findnerd.com/list/view/How-to-use-Gallery-for-scrolling-images-with-page-indicator-in-android/249/#sthash.VLHADP72.dpuf
  • import android.content.Context;
  • import android.util.AttributeSet;
  • import android.view.KeyEvent;
  • import android.view.MotionEvent;
  • import android.widget.Gallery;
  • public class ExtendedGallery extends Gallery{
  • private boolean stuck = false;
  • public ExtendedGallery(Context context, AttributeSet attrs, int defStyle) {
  • super(context, attrs, defStyle);
  • }
  • public ExtendedGallery(Context context, AttributeSet attrs) {
  • super(context, attrs);
  • }
  • public ExtendedGallery(Context context) {
  • super(context);
  • }
  • @Override
  • public boolean onTouchEvent(MotionEvent event) {
  • return stuck || super.onTouchEvent(event);
  • }
  • @Override
  • public boolean onKeyDown(int keyCode, KeyEvent event) {
  • switch (keyCode) {
  • case KeyEvent.KEYCODE_DPAD_LEFT:
  •  
     
    -Read the full Blog at: How to Use Gallery for Scrolling Images with Page Indicator in Android
    FindNerd's Android Developer Forum to post Android Questions and Answers. This forum is developed for those tech geeks who don't want to wait for a longer duration of time, as the community members within FindNerd can answer any android query within shortest possible time frame.
    Apart from this, If you have any language query like C, Java, JavaScript, iOS, Html, PHP etc . you can post at FindNerd's Php questions and answers  forum.

    No comments:

    Post a Comment