How to rotate, scale and move stickers or imageview in Android

Please follow and like us:

android sticker view example

Android StickerView Example – easy to rotate, scale and move/drag image view or text view in entire screen with simple code. I used this library for StickerView. With the help of StickerView, we can handle stickers with the resize and rotate functionality.

Download Android StickerView Example

Step 1: Download above code

Step 2: Create your own new project and add following files (library code)

  • StickerImageView.java
  • StickerTextView.java
  • StickerView.java
  • util > AutoResizeTextView.java
  • Drawable folder’s images

Step 3: add FrameLayout in your layout file and assign id to it.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/canvasView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">


</FrameLayout>

Step 4: initialize FrameLayout and add StickerView dynamically in your java file

package com.nkdroid.stickerview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        FrameLayout canvas = (FrameLayout) findViewById(R.id.canvasView);



// add a stickerImage to canvas
        StickerImageView iv_sticker = new StickerImageView(MainActivity.this);
        iv_sticker.setImageDrawable(getResources().getDrawable(R.drawable.c10));
        canvas.addView(iv_sticker);

// add a stickerText to canvas
        StickerTextView tv_sticker = new StickerTextView(MainActivity.this);
        tv_sticker.setText("nkDroid");
        canvas.addView(tv_sticker);
    }
}

Download Android StickerView Example

android sticker view example tutorial

Hope you like our simple solution for Android StickerView with rotate, scale and move/drag functionality.

 

nirav kalola