GithubHelp home page GithubHelp logo

mindinventory / shimmertextview Goto Github PK

View Code? Open in Web Editor NEW
35.0 5.0 3.0 2.04 MB

ShimmerTextView is a simple library to integrate shimmer effect in your TextView.

Home Page: https://www.mindinventory.com/android-application-development.php

License: MIT License

Kotlin 100.00%
android android-application androidlibrary animation animation-library shimmer-effect textview-android shimmer-text-view shimmer shimmer-android

shimmertextview's Introduction

ShimmerTextView

ShimmerTextView is a simple library to integrate shimmer effect in your TextView.

image image

Key features

  • Set a base color in ShimmerTextView.
  • Set a highlight color in ShimmerTextView.
  • Set animation duration for shimmer effect(in millisecond).
  • Set animation direction(left_to_right, top_to_bottom, right_to_left, bottom_to_top).
  • Set ShimmerTextView shape(Linear/Radial)

Usage

Dependencies

  • Step 1: Add the JitPack repository in your project build.gradle file
allprojects {
	    repositories {
		    ...
		    maven { url 'https://jitpack.io' }
	    }
    }

or

If Android studio version is Arctic Fox or upper then add it in your settings.gradle:

 dependencyResolutionManagement {
    		repositories {
        		...
        		maven { url 'https://jitpack.io' }
    		}
	   }
  • Step 2: Add the dependency in your app module build.gradle file
dependencies {
		    ...
	        implementation 'com.github.Mindinventory:ShimmerTextView:x.x.x'
	}

Implementation

  • Step 1 : Use custom ShimmerTextView in XML.

      <com.app.shimmertextview.ShimmerTextView
          android:id="@+id/textView"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:text="@string/text_mi"
          android:textSize="24sp"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toEndOf="@id/ivLeftToRight"
          app:layout_constraintTop_toTopOf="@id/ivLeftToRight"
          app:layout_constraintBottom_toTopOf="@id/tvLeftToRight"
          app:shimmer_base_color="@color/dark_red"
          app:shimmer_colored="true"
          app:shimmer_highlight_color="@color/orange"
          android:fontFamily="@font/poppins_bold"
          app:shimmer_duration="3000"
          android:layout_marginHorizontal="16dp"
          android:includeFontPadding="false"/>
    
  • Step 2 : Use all attributes dynamically in your.

      class MainActivity : AppCompatActivity() {
          override fun onCreate(savedInstanceState: Bundle?) {
              super.onCreate(savedInstanceState)
              setContentView(R.layout.activity_main)
                      
              val textView = findViewById<ShimmerTextView>(R.id.textView)
              textView.setBaseColor(ContextCompat.getColor(this, R.color.dark_red))
              .setHighLightColor(ContextCompat.getColor(this, R.color.orange))
              .setDirection(Shimmer.Direction.LEFT_TO_RIGHT)
              .build()
              textView.startShimmer()
          }
      }
    

XML Properties

Properties Description
shimmer_base_color Set base color of ShimmerTextView
Shimmer_highlight_color Set highlight color of shimmer animation
shimmer_colored Set it to true for colored ShimmerTextView
shimmer_duration Set duration for animation
shimmer_direction Set animation direction(left_to_right,top_to_bottom, right_to_left, bottom_to_top)

That's it ๐Ÿ‘ and you're good to go ๐Ÿš€

Guideline to report an issue/feature request


It would be very helpful for us, if the reporter can share the below things to understand the root cause of the issue.

  • Library version.
  • Code snippet.
  • Logs if applicable.
  • Screenshot/video with steps to reproduce the issue.

LICENCE


ShimmerTextView is MIT-licensed.

Let us know!


If you use open-source libraries in your project, please make sure to credit us and Give a star to www.mindinventory.com

Please feel free to use this component and let us know if you are interested to building Apps or Designing Products.

shimmertextview's People

Contributors

akashmi avatar bhavinvala18 avatar sanjay-mi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

dharammi yoonusc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.