2

i want to display an image.gif in my splash_screen as a drawable xml many people create the splash screen as layout and play the gif as imageView, so they manage to use animation-list features and start the animation onWindowFocusChanged Methode. and as far as i know, using layout as splash screen it's not the right way. it has to be a drawable!! this is my code for splash.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/background" android:gravity="center"/>
    <item android:drawable="@drawable/logo" android:gravity="center"/>
    <item android:gravity="center" android:bottom="-300dp">
        <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
        <item android:drawable="@drawable/frame1" android:duration="250"/>
        <item android:drawable="@drawable/frame2" android:duration="250"/>
        <item android:drawable="@drawable/frame3" android:duration="250"/>
        <item android:drawable="@drawable/frame4" android:duration="250"/>
    </animation-list>
    </item>

</layer-list>

by the way the image.gif it's a loading animation and as you can see, i have 2 other images.

i'm not sure if it's possible to do it in this way, but i do like it to be a real splash screen, not just a view shows up first before the mainActivity.

just to edit: i do care about the type of xml, i want it to be a draweble resource file not layout resource file, because as they said, it's the right way to create a splash screen.

shadow
  • 767
  • 3
  • 8
  • 20
  • Possible duplicate of [Can I Add GIF format Image as a Splash Screen](https://stackoverflow.com/questions/39871405/can-i-add-gif-format-image-as-a-splash-screen) – Casper Nov 13 '17 at 16:25
  • i have read that question and it's not the same, as you can see, i said i do care about the type of xml, i don't want it to be like a layout activity, i wanted as a drawable resource.. because as far as i know, the right way to create a splash screen is to use that kind of xml... and correct me please if i'm wrong, because if it's the same thing, that would solve many problems – shadow Nov 13 '17 at 17:52
  • @shadow I am trying to accomplish the same thing. Did you ever find a solution to this ? – Omar Rodriguez Feb 05 '18 at 20:09
  • nope, i couldn't find a solution, all i had to do is to display the first image as splash screen and then play the gif image in the first activity after a delay it will redirect automatically to the next activity.i guess it's better than nothing, ( some suggestions was to split the gif image into multi images and then play them one by one like a gif, after all that's a gif image but it didn't work for me and it took too much time) – shadow Feb 08 '18 at 12:41

0 Answers0