1

Brief, bulletin point description of my problem:

  • Tried to move a view to new location and clickable.
  • Failed because only the imagery (image + text) moved to the new location while view itself programactically stayed behind.
  • Will fire ClickListener events only if original location instead of new location were clicked
  • Attempt to move view to the same location with the following code:

    public void onAnimationEnd(Animation animation) {
    
            ConstraintLayout.LayoutParams constraintLayoutParams = (ConstraintLayout.LayoutParams) swipeGridMenu.getLayoutParams();
            constraintLayoutParams.leftMargin = 548; 
            swipeGridMenu.setLayoutParams(constraintLayoutParams);
    
        }
    
  • End result resembles the following, nothing like purposed: enter image description here

  • Both imagery and view moves as parameter changes, the 2 simply border each other instead of properly overlapping and aligned.
  • Both setFillAfter and setFillEnabled were set to true.

How do I fix this?

VictorCharlie23
  • 121
  • 1
  • 10
  • I'm not sure to completely understand your problem but It seems you are misunderstanding how animation works. The animation is a graphic representation but do not change the reactive area of the UI elements. Could it be this your problem? – Walter Palladino Oct 23 '17 at 12:35
  • You are absolutely right but that's not the point at this moment. – VictorCharlie23 Oct 24 '17 at 01:10
  • The point is that I want to move my reactionary area to a new area, THE SAME EXACT area of the imagery, but failed to find the proper way to do so, at least constraintLayoutParams.leftMargin = xxx; doesn't work. – VictorCharlie23 Oct 24 '17 at 01:16
  • Maybe this could help you: https://stackoverflow.com/questions/6535648/how-can-i-dynamically-set-the-position-of-view-in-android. Remember to set the type of the parameters based on the layout inside which your inner elements are located. I think your case is ConstraintLayout. – Walter Palladino Oct 24 '17 at 10:20

0 Answers0