i'm complete newbie android. how can fade in main activity? after open app want screen black , fade in image. have been trying last 2 hours , can't seem find solution.
this code:
package com.example.radu.gladiators2; import android.os.bundle; import android.support.annotation.nullable; import android.support.v7.app.appcompatactivity; import android.view.view; import android.view.windowmanager; import android.view.animation.animation; import android.view.animation.animationutils; import android.widget.imageview; /** * created radu on 8/8/2016. */ public class splash extends appcompatactivity { @override protected void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.splash_screen); } @override public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); view decorview = getwindow().getdecorview(); if (hasfocus) { decorview.setsystemuivisibility( view.system_ui_flag_layout_stable | view.system_ui_flag_layout_hide_navigation | view.system_ui_flag_layout_fullscreen | view.system_ui_flag_hide_navigation | view.system_ui_flag_fullscreen | view.system_ui_flag_immersive_sticky);} } }
and xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/splash_image" android:id="@+id/imageview" android:scaletype="centercrop" />
try this:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layoutanimation="@android.r.anim.fade_in" > <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/splash_image" android:id="@+id/imageview" android:scaletype="centercrop" />
Comments
Post a Comment