Last active
June 9, 2019 10:51
-
-
Save senamit2708/75cec1abdcc0d65bc87a7ed0f8544d6e to your computer and use it in GitHub Desktop.
Cool loading of android app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create this file inside the drawable section... | |
//here jpg imge is used | |
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@color/colorPrimary" /> | |
<item> | |
<bitmap android:src="@drawable/tuktukone" | |
android:gravity="center" /> | |
</item> | |
</layer-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App takes cool time to start the app... | |
I am using android jetpack mvvm archietecture to create app..so i have only one activity and rest are fragments. | |
So, create one more activity, because we need to use one style here..so dont distrub your main activity for this. | |
one new activity is created, | |
then one drawable ...and in this drawable use image from drawable(Here is a catch dont use vector image or any other type of file ..use jpg image here) | |
now create one style and then in that style inside window background item put that newly created drawable | |
--inside toolbar style theme, add one more line | |
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | |
put this style in the mainfest of that activity | |
and then run it | |
sources:- | |
https://medium.com/@ssaurel/create-a-splash-screen-on-android-the-right-way-93d6fb444857 | |
https://developer.android.com/topic/performance/vitals/launch-time#themed | |
https://stackoverflow.com/questions/54053614/splash-screen-error-android-content-res-resourcesnotfoundexception-drawable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity android:name=".activities.SplashActivity" | |
android:theme="@style/SplashTheme"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN"/> | |
<category android:name="android.intent.category.LAUNCHER"/> | |
</intent-filter> | |
</activity> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@android:color/white" | |
tools:context="amit.diary.studentdiaryentryTwo.activities.SplashActivity"> | |
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SplashActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_splash); | |
Intent intent = new Intent(SplashActivity.this, SchoolDiaryMainActivity.class); | |
startActivity(intent); | |
finish(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | |
<!-- android:textColorPrimary is the color of the title text in the Toolbar --> | |
<item name="android:textColorPrimary">@android:color/black</item> | |
<!-- actionMenuTextColor is the color of the text of action (menu) items --> | |
<item name="actionMenuTextColor">@android:color/holo_green_light</item> | |
<!-- Tints the input fields like checkboxes and text fields --> | |
<item name="colorAccent">@color/colorPrimary</item> | |
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | |
</style> | |
<style name="SplashTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> | |
<item name="android:windowBackground">@drawable/background</item> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment