Show Gif Image in Android Oreo 8.1 and Above

Jyotishgher Astrology
By -
0
Hi Friends,
Today I a going to Show you how to Implement GIF image into your Android Application For Android Oreo 8.1 and Above as there seems to be difficult to show recently google Update .

Let's Start

First of All Create XML Layout as Shown Below main_splash_screen


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">


<ImageView
android:id="@+id/imgLogo"


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/phone"
android:visibility="gone" />


<ImageView
android:id="@+id/imgLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/phone"
android:visibility="gone" />

<com.whygraphics.gifview.gif.GIFView

<com.whygraphics.gifview.gif.GIFView
android:id="@+id/main_activity_gif_vie"
gif_view:gif_src="url:https://media.giphy.com/media/1Air4nbUFD9fLJzGjb/giphy.gif"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter" />


<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:gravity="center_horizontal"
android:text="Developed by\nRCF IT DEPARTMENT"
android:textColor="@color/button_bg"
android:textSize="18sp"
android:textStyle="bold|italic"
android:typeface="serif" />

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:gravity="center_horizontal"
android:text="Developed by\nRCF IT DEPARTMENT"
android:textColor="@color/button_bg"
android:textSize="18sp"
android:textStyle="bold|italic"
android:typeface="serif" />

</RelativeLayout>

</RelativeLayout>




Now Create Your Java File Such as :SplashActivity

import android.Manifest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

import android.widget.Toast;


import com.whygraphics.gifview.gif.GIFView;


import rcfinternal.nanoakhi.irtds.R;
import rcfinternal.nanoakhi.irtds.RuntimePermissionsActivity.RuntimePermissionsActivity;
import rcfinternal.nanoakhi.irtds.ScrollingActivity;

/** * Created by NanoAkhi on 08-Jun-17. */
public class SplashActivity extends AppsCombatActivity {


    private static final int REQUEST_PERMISSIONS = 20;
    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_splash_screen);


        GIFView mGifView = (GIFView) findViewById(R.id.main_activity_gif_vie);
        mGifView.setOnSettingGifListener(new GIFView.OnSettingGifListener() 



{          
  @Override            
public void onSuccess(GIFView view, Exception e) 
{
         
		 }

  @Override           

public void onFailure(GIFView view, Exception e)
 {
           
		   }        
			});

}


WHAT TO REMEMBER HOST YOUR GIF IMAGE SOMEWHERE IN URL OR WEBSITE OR YOU CAN USE BELOW LINK:


https://media.giphy.com/media/1Air4nbUFD9fLJzGjb/giphy.gif

Post a Comment

0Comments

Post a Comment (0)