|
| 1 | +ShimmerTextView |
| 2 | +==== |
| 3 | + |
| 4 | +ShimmerTextView is a simple library to integrate shimmer effect in your TextView. |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +# Key features |
| 10 | + |
| 11 | +* Set a base color in ShimmerTextView. |
| 12 | +* Set a highlight color in ShimmerTextView. |
| 13 | +* Set animation duration for shimmer effect(in millisecond). |
| 14 | +* Set animation direction(left_to_right, top_to_bottom, right_to_left, bottom_to_top). |
| 15 | +* Set ShimmerTextView shape(Linear/Radial) |
| 16 | + |
| 17 | +# Usage |
| 18 | + |
| 19 | +**Dependencies** |
| 20 | +> Insert gradle dependency here. |
| 21 | +
|
| 22 | +**Implementation** |
| 23 | + |
| 24 | +* Step 1 : Use custom ShimmerTextView in XML. |
| 25 | + |
| 26 | + <com.app.shimmertextview.ShimmerTextView |
| 27 | + android:id="@+id/textView" |
| 28 | + android:layout_width="0dp" |
| 29 | + android:layout_height="wrap_content" |
| 30 | + android:text="@string/text_mi" |
| 31 | + android:textSize="24sp" |
| 32 | + app:layout_constraintEnd_toEndOf="parent" |
| 33 | + app:layout_constraintStart_toEndOf="@id/ivLeftToRight" |
| 34 | + app:layout_constraintTop_toTopOf="@id/ivLeftToRight" |
| 35 | + app:layout_constraintBottom_toTopOf="@id/tvLeftToRight" |
| 36 | + app:shimmer_base_color="@color/dark_red" |
| 37 | + app:shimmer_colored="true" |
| 38 | + app:shimmer_highlight_color="@color/orange" |
| 39 | + android:fontFamily="@font/poppins_bold" |
| 40 | + app:shimmer_duration="3000" |
| 41 | + android:layout_marginHorizontal="16dp" |
| 42 | + android:includeFontPadding="false"/> |
| 43 | + |
| 44 | +* Step 2 : Use all attributes dynamically in your. |
| 45 | + |
| 46 | + class MainActivity : AppCompatActivity() { |
| 47 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 48 | + super.onCreate(savedInstanceState) |
| 49 | + setContentView(R.layout.activity_main) |
| 50 | + |
| 51 | + val textView = findViewById<ShimmerTextView>(R.id.textView) |
| 52 | + textView.setBaseColor(ContextCompat.getColor(this, R.color.dark_red)) |
| 53 | + .setHighLightColor(ContextCompat.getColor(this, R.color.orange)) |
| 54 | + .setDirection(Shimmer.Direction.LEFT_TO_RIGHT) |
| 55 | + .build() |
| 56 | + textView.startShimmer() |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | +**XML Properties** |
| 61 | + |
| 62 | +| Properties | Description | |
| 63 | +|------------------------|-------------------------------------------| |
| 64 | +|shimmer_base_color |Set base color of ShimmerTextView | |
| 65 | +|Shimmer_highlight_color |Set highlight color of shimmer animation | |
| 66 | +|shimmer_colored |Set it to true for colored ShimmerTextView | |
| 67 | +|shimmer_duration |Set duration for animation | |
| 68 | +|shimmer_direction |Set animation direction(left_to_right,top_to_bottom, right_to_left, bottom_to_top)| |
| 69 | + |
| 70 | +That's it 👍 and you're good to go 🚀 |
| 71 | + |
| 72 | +### Guideline to report an issue/feature request |
| 73 | +--------- |
| 74 | +It would be very helpful for us, if the reporter can share the below things to understand the root cause of the issue. |
| 75 | + |
| 76 | +* Library version. |
| 77 | +* Code snippet. |
| 78 | +* Logs if applicable. |
| 79 | +* Screenshot/video with steps to reproduce the issue. |
| 80 | + |
| 81 | +### LICENCE |
| 82 | +---------------- |
| 83 | +ShimmerTextView is [MIT-licensed.](https://git.mindinventory.com/mi-android/android-libs/shimmertextview/-/blob/master/LICENSE) |
| 84 | + |
| 85 | +### Let us know! |
| 86 | +--------- |
| 87 | +If you use open-source libraries in your project, please make sure to credit us and Give a star to [www.mindinventory.com](https://www.mindinventory.com/) |
| 88 | + |
| 89 | +Please feel free to use this component and let us know if you are interested to building Apps or Designing Products. |
0 commit comments