Home > other >  layout background pattern
layout background pattern

Time:01-13

1

I would like to know if it is possible create this in android studio for layout background of my activity.

Reapet a drawable and move in a direction.

CodePudding user response:

You can try adding this dependency to add gif animation:

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'

and use FrameLayout.

As an alternative, consider the using the MotionLayout widget to manage motion and widget animation.

CodePudding user response:

This can be done in many ways:

  1. Animated Vector Drawable as the android:background
  2. Animated Gif
  3. Object Animators
  4. MotionLayout

1 There is many ways to create this. The most elegant and efficient solution is an an animated vector drawable. But it is also difficult to get all the information together to do it.

2 This Gif will be big or blurry and a resource hog. but simple to implement

3 ObjectAnimator straightforward create a collect of (about 6)black views , rotate 45 degrees and use a series of ObjectAnimators to translateX/Y

4 MotionLayout would allow this without code and mostly in studio

  1. Create A Constraint Layout
  2. drag 6 black views, rotate and Position them using the Attributes
  3. Convert to MotionLayout
  4. In the "End" ConstraintSet Modify TranslationX & TranslationY
  5. Set Transition to AutoStart
  6. Create A Transition to AutoJump back to the end.
  • Related