Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to resolve ImageView padding issue inside HorizontalScrollView on Android
    text
    copied!<p><img src="https://i.stack.imgur.com/dyfaN.png" alt="enter image description here"></p> <p>As shown in the image, I have tabs as in browser tabs. And I have padding between tab images to overlap on each other adjacent images. I need a particular image needs to be on top of adjacent images(image below) when the user touches it and also want to do the same through code.</p> <p><img src="https://i.stack.imgur.com/UQgCB.png" alt="enter image description here"></p> <p>I have a onTouchListener to the whole scrollview. It works fine with the below code when the user manually touches the image.</p> <pre><code>tab[id].bringToFront(); tabScrollView.invalidate(); </code></pre> <p>If I do the same through code instead of manual user touch, the selected tab image goes to the right end since it uses bringToFront() method. Is there any way how I can bring it just on top of adjacent images?</p> <p>Update:</p> <p>I have already tried,</p> <pre><code>tab[id].performClick(); tab[id].performLongClick(); </code></pre> <p>And also tried,</p> <pre><code>tab[id].setOnTouchListener(new MyTouchListener()); //my own listener // Obtain MotionEvent object long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis() + 100; float x = 0.0f; float y = 0.0f; int metaState = 0; MotionEvent motionEvent = MotionEvent.obtain( downTime, eventTime, MotionEvent.ACTION_UP, x, y, metaState ); // Dispatch touch event to view tab[id].dispatchTouchEvent(motionEvent); </code></pre> <p>Both the methods mentioned above doesn't help. Do I need to provide any more details?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload