Last active
December 24, 2021 08:48
-
-
Save minibugdev/2228539e3e7734f99e7379d12cac828c to your computer and use it in GitHub Desktop.
Android Marquee Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val marquee = AnimationUtils.loadAnimation(context, R.anim.marquee) | |
textView.startAnimation(marquee) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:gravity="center_vertical" | |
android:orientation="horizontal"> | |
<ImageView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginHorizontal="8dp" | |
android:src="@drawable/icon" /> | |
<FrameLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/textView" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:ellipsize="none" | |
android:singleLine="true" | |
android:text="Text Text Text" /> | |
</FrameLayout> | |
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- anim/marquee.xml --> | |
<?xml version="1.0" encoding="utf-8"?> | |
<set xmlns:android="http://schemas.android.com/apk/res/android"> | |
<translate | |
android:duration="10000" | |
android:fromXDelta="100%" | |
android:repeatCount="infinite" | |
android:repeatMode="restart" | |
android:toXDelta="-100%" /> | |
</set> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment