Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3598552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:15:23+00:00 2026-05-18T20:15:23+00:00

I want to drag n drop the text view on image in android 2.X

  • 0

I want to drag n drop the text view on image in android 2.X

please , look at this image below.
alt text

Here, “Blue” color represents the ViewGrop , “White” is ImageView and the image is set on the ImageView.
the text written “Fashion” is a TextView.This is how i have implement the structure. Now i want to allow the user to select the TextView and drag it to any part of the image and then drop it over the image at desired position.

As of now for a reference i tried to refer the following url but whenever i use TextView instead of Button things are getting abnormal.

link text

Can anyone give me the road map or example to get it done ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:15:24+00:00Added an answer on May 18, 2026 at 8:15 pm

    Instead, try getting your ImageView as a canvas to draw into.

    ImageView CanvasView = (ImageView) findViewById(R.id.fashion_pic)

    From here you can create your own Bitmap and re-draw it after a TouchEvent. The following snippet contains a necessary work-around for a bug in 2.1 (or 2.2, I can’t remember):

    public void redrawImage() {
    
        Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.fashion_pic);
        Bitmap proxy = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Config.ARGB_8888);
        Canvas c = new Canvas(proxy);
    
        //Here, we draw the background image.
        c.drawBitmap(bm, new Matrix(), null);
    
        //Here, we draw the text where the user last touched.
        c.drawText("Fashion", someGlobalXvariable, someGlobalYvariable, somePaint);
    
        CanvasView.setImageBitmap(proxy);
    }
    

    Here, you have created a canvas which already has your picture as the background and paints text at an x and y variable. Now, just set an OnTouchListener:

    CanvasView.setOnTouchListener( new OnTouchListener(){
    
        public boolean onTouch(View v, MotionEvent e) {
    
            someGlobalXvariable = e.getX();
            someGlobalYvariable = e.getY();
            redrawImage();
            return true;
        }
    });
    

    As you can see, the listener automatically updates your image when it is touched, and the text will follow the user’s finger. Since you’re using a Bitmap as your canvas, you can also add support for saving/loading an image if your app wants to have that kind of functionality.

    Edit: It may be more performance-friendly if you move lines 1-3 from redrawImage() and place them elsewhere, setting those objects as global objects. I’ll let you tinker with that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to drag n drop the text view on image in android 2.X
I want to drag and drop an image on wpf application form. Can anyone
I have a checkedlistbox and I want to drag and drop only image extensions
I want a user to be able to drag and drop plain text (external
I want to do a simple drag-drop using jQuery. I have not done anything
Hey I am implementing the drag and drop operations using Kineticjs Now I want
We're trying to implement drag and drop in Silverlight (3). We want users to
I want to drag and drop a file so that the textbox shows the
I have a ListView and I want to perform Drag and Drop on list
I am using VS 2005. I want to drag-and-drop a Word Document 2003/2007 control

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.