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

  • SEARCH
  • Home
  • 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 8118147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:23:30+00:00 2026-06-06T04:23:30+00:00

Edit: This problem was down to me passing the wrong view to the Touch

  • 0

Edit: This problem was down to me passing the wrong view to the Touch Delegate…problem is resolved now….

My RelativeLayout extension enlarges the clickable area of an ImageView. The RelativeLayout is the root View of the ListView row. The problem is when tapping areas that should be delegated to the ImageView, the ListView‘s onItemClicked is triggered.

My code is at the end and below is an image of what the extended bounds of the ImageView should be. If I tap on blue areas that are not the image, the click is received by the ListView.

Blue areas indicate new bounds of the ImageView

public class DelegatingRelativeLayout extends RelativeLayout {

//relevant code moved to top
@Override 
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    final float density = getContext().getResources().getDisplayMetrics().density;
    int extra = (int) (density * 4 + 0.5f);

    Rect rect = new Rect(0, 0, mEnlargedView.getWidth(), getHeight());
    rect.right += extra; //extend bounds by 4 pixels
    setTouchDelegate(new TouchDelegate(rect, mEnlargedView));
    mExtendedBounds = rect;
}

public void setEnlargedView(View v) {       
    mEnlargedView = v;
}

private static final boolean DEBUG_DRAW = true;

private View mEnlargedView;
private Rect mExtendedBounds;

//constructors removed

@Override
protected void dispatchDraw(Canvas canvas) {

    if (DEBUG_DRAW) {
        Paint p = new Paint();
        p.setColor(Color.BLUE);
        canvas.drawRect(mExtendedBounds, p);
    }

    super.dispatchDraw(canvas);
}

}
  • 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-06-06T04:23:31+00:00Added an answer on June 6, 2026 at 4:23 am

    Ugh, I’ve just realized I’ve been passing the wrong view to the touch delegate >.< It’s been working fine now…. >.<

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

Sidebar

Related Questions

THIRD EDIT: I now believe that this problem is due to a SOAP version
[Edit: This problem applies only to 32-bit systems. If your computer, your OS and
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
Edit : The bug that caused this problem has been fixed. The @version tag
EDIT: Just to make things clear, this problem was caused by a typo in
[EDIT] I am changing this to more concisely explain what my problem was, after
This is a weird problem. I am using a dataform, and when I edit
Edit This question has gone through a few iterations by now, so feel free
EDIT: I have now discovered the problem is with my WCF service getting dirty
I am able to break this problem down into two questions: What is the

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.