Practice the custom styles and themes, inherit the default styles and modify the Android system, practice XML definition fade animations
Anim/fade_in.xml
<? XML version= "1.0" encoding= "Utf-8" ?> < xmlns:android= "http://schemas.android.com/apk/res/android" android:duration = " android:fromalpha" = "0.0" android:toalpha= "1.0"/>
Anim/fade_out.xml
<? XML version= "1.0" encoding= "Utf-8" ?> < xmlns:android= "http://schemas.android.com/apk/res/android" android: Fromalpha= "1.0" android:toalpha= "0.0" android:duration = "/> "
Values/styles.xml
<?XML version= "1.0" encoding= "Utf-8"?><Resourcesxmlns:android= "Http://schemas.android.com/apk/res/android"> <!--Custom Animation Styles - <stylename= ' fade 'Parent= "@android: style/animation.activity"> <Itemname= "Android:activityopenenteranimation">@anim/fade_in</Item> <Itemname= "Android:activityopenexitanimation">@anim/fade_out</Item> <Itemname= "Android:activitycloseenteranimation">@anim/fade_in</Item> <Itemname= "Android:activitycloseexitanimation">@anim/fade_out</Item> </style> <!--Custom Animated Themes - <stylename= "Theme.tsh"Parent= "@android: Style/theme.light.notitlebar"> <Itemname= "Android:windowanimationstyle">@style/fade</Item> </style></Resources>
Mainactivity.java
Packagecom.example.tsh;Importandroid.app.Activity;Importandroid.content.Intent;ImportAndroid.os.Bundle;ImportAndroid.os.Handler; Public classMainactivityextendsActivity {PrivateHandler handler=NewHandler (); @Overrideprotected voidonCreate (Bundle savedinstancestate) {//TODO auto-generated Method Stub Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); Handler.postdelayed (NewRunnable () {@Override Public voidrun () {Intent Intent=NewIntent (mainactivity. This, Twoactivity.class); StartActivity (Intent); } }, 3000); }}
Manifest.xml
<?XML version= "1.0" encoding= "Utf-8"?><Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.tsh"Android:versioncode= "1"Android:versionname= "1.0" > <USES-SDKandroid:minsdkversion= "8"android:targetsdkversion= "+" /> <ApplicationAndroid:allowbackup= "true"Android:icon= "@drawable/ic_launcher"Android:label= "ss" > <ActivityAndroid:name=". Mainactivity "Android:label= "Home"Android:theme= "@style/theme.tsh" > <Intent-filter> <ActionAndroid:name= "Android.intent.action.MAIN" /> <categoryAndroid:name= "Android.intent.category.LAUNCHER" /> </Intent-filter> </Activity> <ActivityAndroid:name=". Twoactivity "Android:theme= "@style/theme.tsh" > </Activity> </Application></Manifest>
[Android] Practice style theme customizing activity toggle Animation