Guest User

Untitled

a guest
Nov 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <!-- Top most LinearLayout-->
  2. <LinearLayout>
  3.  
  4. <!-- LinearLayout containing android:animateLayoutChanges="true"-->
  5. <LinearLayout>
  6.  
  7. <!-- RelativeLayout containing button to toggle LinearLayout visibility below-->
  8. <RelativeLayout>
  9. </RelativeLayout>
  10.  
  11. <!-- LinearLayout that has its visibility toggled -->
  12. <LinearLayout>
  13. </LinearLayout>
  14.  
  15. </LinearLayout>
  16.  
  17. </LinearLayout>
  18.  
  19. <LinearLayout
  20. android:id="@+id/form_container"
  21. android:layout_width="match_parent"
  22. android:layout_height="wrap_content"
  23. android:orientation="vertical" >
  24.  
  25. <!-- This is where the previous XML layout containing the toggle-able LinearLayout
  26. is inserted programmatically. -->
  27.  
  28. <!-- This button snaps back up to the top before the animation is complete. -->
  29. <Button />
  30.  
  31. </LinearLayout>
  32.  
  33. myButton.animate().translationY(floatYposition).setDuration(300); //300 milliseconds
  34.  
  35. <LinearLayout android:id="@+id/transitions_container">
  36.  
  37. <!--add your widgets here-->
  38.  
  39. </LinearLayout>
  40.  
  41. final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
  42.  
  43. button.setOnClickListener(new View.OnClickListener() {
  44. @Override
  45. public void onClick(View v) {
  46. TransitionManager.beginDelayedTransition(transitionsContainer);
  47. // do your staff with changing children of transitionsContainer
  48. }
  49. });
Add Comment
Please, Sign In to add comment