Shimmer Effect For Android By Using Shimmer Java Library
Shimmer is a java library that provides an easy way to add a shimmer effect     to any view in your Android app. It is useful as an unobtrusive loading     indicator. It was originally developed for     Facebook Home.     
Shimmer for Android is implemented as a layout, which means that you can simply nest any view inside a
Here's an example of a composite view, consisting of an image and some text below it, that shows the effect in action:
Shimmer for Android is implemented as a layout, which means that you can simply nest any view inside a
SHIMMER FRAME LAYOUT tag, and call to start     the animation from your code. That's all that is required. The layout will use the     values you specify either on the tag (using custom attributes) or programmatically     in your code, and generate an animation on the fly. See the      API reference for further details.     Here's an example of a composite view, consisting of an image and some text below it, that shows the effect in action:
Firstly We Need To Add The Shimmer Library Dependencyin out build.gradle app level file compile 'com.facebook.shimmer:shimmer:0.1.0@aar' Then We Place Our Complex Layout In The Shimmer Frame Layout  <?xml version="1.0" encoding="utf-8"?>
<com.facebook.shimmer.ShimmerFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/shimmer_view_container"
android:layout_width="match_parent"
android:background="#11051b"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_gravity="center"
android:textColor="#f44d14"
android:text="Shimmer Effect"
android:textSize="30dp"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@mipmap/ic_launcher"
android:layout_marginTop="100dp"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:layout_gravity="center"
android:textColor="#f44d14"
android:textSize="20dp"
android:text="Android Gits"/>
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
Then We Get Reference Of The Shimmer Frame Layout By Using It IDand then we start animation for start animation we use the two function one for set the duration of the animation and second oneis to autostart the animation  package android.example.com.shimmereffect;
// created by androidgits.blogspot.in
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.facebook.shimmer.ShimmerFrameLayout;
public class MainActivity extends AppCompatActivity {
TextView text_view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ShimmerFrameLayout container =
(ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
container.setDuration(1700);
container.setAutoStart(true);
//container.startShimmerAnimation();
}
}
Finally Run The App And You Will Get The Shimmer Effect For Full Reference Visit On This Library Official WebsiteShimmer Java Library for Android  



Komentar
Posting Komentar