Your solution is to invalidate
your CustomView
after TextView.setText()
setText()
before layout or passing values โโfor your left, hard, ...
private void processDrag(View v, MotionEvent event){ if(listener != null){
Why? TextView.setText()
triggers invalidate
and requestLayout()
at the same time for forced layout, but Invalidate()
just tells the parent object that it is dirty, so it needs to execute the top layout.
(im confused, so I will not continue to support this, so I am jumping). Your TextView
is inside the parent layout, in which the grandiose child is your usual view, and Invalidate()
re-lays all of them, so it sends your custom view back to its position, however, if you exclude it, and call explicit Invalidate()
in your user view it tells the parent that its dirty same process is happening, but this time only with RelativeLayout
User: Zeid Qureshi has already informed you about this.
Also, I donโt know if you know that the layoutParams provided to your customView belongs to the parent staff that you do not control, but os, and the introduced Params are what are used for the layout, and give additions, etc. for your view, and since you do not post them, you simply skip the position.
I hope I have a point for you and it helps
source share