Array
(
    [0] => WP_Term Object
        (
            [term_id] => 21
            [name] => Android
            [slug] => android
            [term_group] => 0
            [term_taxonomy_id] => 21
            [taxonomy] => category
            [description] => 
            [parent] => 0
            [count] => 94
            [filter] => raw
            [cat_ID] => 21
            [category_count] => 94
            [category_description] => 
            [cat_name] => Android
            [category_nicename] => android
            [category_parent] => 0
        )

    [1] => WP_Term Object
        (
            [term_id] => 22
            [name] => Android Library
            [slug] => android-library
            [term_group] => 0
            [term_taxonomy_id] => 22
            [taxonomy] => category
            [description] => 
            [parent] => 0
            [count] => 61
            [filter] => raw
            [cat_ID] => 22
            [category_count] => 61
            [category_description] => 
            [cat_name] => Android Library
            [category_nicename] => android-library
            [category_parent] => 0
        )

    [2] => WP_Term Object
        (
            [term_id] => 2
            [name] => Featured
            [slug] => featured
            [term_group] => 0
            [term_taxonomy_id] => 2
            [taxonomy] => category
            [description] => It is list of posts given by Editorial hand-picked. May be you enjoy all of this articles.
            [parent] => 0
            [count] => 73
            [filter] => raw
            [cat_ID] => 2
            [category_count] => 73
            [category_description] => It is list of posts given by Editorial hand-picked. May be you enjoy all of this articles.
            [cat_name] => Featured
            [category_nicename] => featured
            [category_parent] => 0
        )

)
///////////

Add touch functionality ImageView using TouchImageView Library

0
82
How to Add touch functionality in ImageView using TouchImageView Library
How to Add touch functionality in ImageView using TouchImageView Library

Obviously you use ImageView in your Android application but when you want to add touch functionality in ImageView then what you’ll do. Yes you’ll write a lengthy code which take your time waste.

But today i am going to show you a hero for this purpose and the name of that Android library is TouchImageLibrary. Let see what is it.

TouchImageView extends ImageView and supports all of ImageView’s functionality.
In addition, TouchImageView adds pinch zoom, dragging, fling, double tap zoom
functionality and other animation polish. The intention is for TouchImageView to
mirror as closely as possible the functionality of zoomable images in Gallery
apps.

Advertisement

How to Add touch functionality in ImageView using this library

Place TouchImageView.java in your project. It can then be used the same as
ImageView.

Example:

TouchImageView img = (TouchImageView) findViewById(R.id.img);

If you are using TouchImageView in xml, then you must provide the full package name, because it is a custom view.

Example:

<com.example.touch.TouchImageView
android:id="@+id/img”
android:layout_width="match_parent"
android:layout_height="match_parent" />

API:

// Get the current zoom. This is the zoom relative to the initial
// scale, not the original resource.
float getCurrentZoom();

// Get the max zoom multiplier.
float getMaxZoom();

// Get the min zoom multiplier.
float getMinZoom();

// Return the point at the center of the zoomable image. The PointF coordinates range
// in value between 0 and 1 and the focus point is denoted as a fraction from the left 
// and top of the view. For example, the top left corner of the image would be (0, 0). 
// And the bottom right corner would be (1, 1).
PointF getScrollPosition();

// Return a Rect representing the zoomed image.
RectF getZoomedRect();

// Returns false if image is in initial, unzoomed state. False, otherwise.
boolean isZoomed();

// Reset zoom and translation to initial state.
void resetZoom();

// Set the max zoom multiplier. Default value: 3.
void setMaxZoom(float max);

// Set the min zoom multiplier. Default value: 1.
void setMinZoom(float min);

// Set the focus point of the zoomed image. The focus points are denoted as a fraction 
// from the left and top of the view. The focus points can range in value between 0 and 1. 
void setScrollPosition(float focusX, float focusY);

// Set zoom to the specified scale. Image will be centered by default.
void setZoom(float scale);

// Set zoom to the specified scale. Image will be centered around the point
// (focusX, focusY). These floats range from 0 to 1 and denote the focus point
// as a fraction from the left and top of the view. For example, the top left 
// corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
void setZoom(float scale, float focusX, float focusY);

// Set zoom to the specified scale. Image will be centered around the point
// (focusX, focusY). These floats range from 0 to 1 and denote the focus point
// as a fraction from the left and top of the view. For example, the top left 
// corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
void setZoom(float scale, float focusX, float focusY, ScaleType scaleType);

// Set zoom parameters equal to another TouchImageView. Including scale, position,
// and ScaleType.
void setZoom(TouchImageView img);

Examples:

Please view the sample app which includes examples of the following functionality:

  • Single TouchImageview: basic use of a single TouchImageView. Includes usage
    of OnTouchImageViewListener, getScrollPosition(), getZoomedRect(), isZoomed(),
    and getCurrentZoom().
  • ViewPager Example: TouchImageViews placed in a ViewPager like the Gallery app.
  • Mirroring Example: mirror two TouchImageViews using
    onTouchImageViewListener and setZoom().
  • Switch Image Example: Click on TouchImageView to cycle through images. Note that the zoom state is maintained though the images are switched.
  • Switch ScaleType Example: Click on TouchImageView to cycle through supported ScaleTypes.

Limitations:

TouchImageView does not yet support pinch image rotation. Also, FIT_START and FIT_END
scaleTypes are not yet supported.

Hope you like this tutorial and please comment us your thought and suggestions.

Share your thoughts

Loading Facebook Comments ...
Loading Disqus Comments ...