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 7067613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:13:25+00:00 2026-05-28T05:13:25+00:00

I have a custom ImageView(‘CustomImageView’) and an Edit-text in a linear layout of an

  • 0

I have a custom ImageView(‘CustomImageView’) and an Edit-text in a linear layout of an activity ‘ImageViewActivity’. The Edit-text is initially set invisible. When the customimageview is touched, and onDraw() is called, I want the visibility of the Edit-text to be set visible. Where should I put the code for this?
Code for ImageViewActivity:

public class ImageViewActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.custom_imageview);


    }
}

And the code for CustomImageView is:

public class CustomImageView extends ImageView {

Paint paint = new Paint();
float xp = -1, yp = -1;
private Options opt;


public CustomImageView(Context context) {
    super(context);
    init();
}

public CustomImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
}

public CustomImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    init();
}

public void init() {

    opt = new BitmapFactory.Options();
    opt.inJustDecodeBounds = true;

    paint.setAntiAlias(true);
    paint.setColor(Color.RED);

    paint.setStyle(Paint.Style.FILL);

}

@Override
public boolean onTouchEvent(MotionEvent event) {

        if (event.getAction() == MotionEvent.ACTION_UP) {

        xp = event.getX();
        yp = event.getY();

        invalidate();

    } 
    return true;
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        //some code
        setMeasuredDimension(width, height);

}



@Override
protected void onDraw(Canvas canvas) {

    super.onDraw(canvas);

    if (xp >= 0 && yp > 0) {

            canvas.drawCircle(xp, yp, 20, paint);

        }
    }


}
  • 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-28T05:13:25+00:00Added an answer on May 28, 2026 at 5:13 am

    Implement touch listener on your customImageview class and then call the edittext to hide it or show is as you need, for results of touch on custom view you have to define touchlistener on your customview not of activity and you can manage views of parent activity in touchevent of customview OR other method is implement touch listener on you activity and find the view which is touched if touched view is your custom view then make visible your Edittext. Then you will not need to do anything in onDraw() as regarding the edittext.

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

Sidebar

Related Questions

I have an Activity with a layout containing a custom ImageView and a few
I have this custom class ... public class DrawView extends ImageView When I set
I have this custom layout: - LinearLayout - FrameLayout - ImageView - TextView This
I have a custom spinner layout with an image and a text view but
I have a custom notification that uses a LinearLayout that contains an ImageView and
I have a custom ListView and an ImageView that I'm trying to use as
I have a custom layout that I have written that basically just displays a
I have made custom .xml layout for ListView. Now it looks: But it isn't
I have created a custom view by extending Relative Layout and it looks like
I have four imageview in sequence on a screen setting with custom background images.

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.