我正在開發一個Android應用程序,我需要設置單獨的啓動屏幕,一個用於縱向,一個用於橫向。兩者都是不同的圖像。我該怎麼做?如何在Android中爲橫向和縱向模式設置單獨的啓動畫面?
activity_splash.xml
<?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"
>
<ImageView
android:id="@+id/imgLogo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/wwe_logo" />
</RelativeLayout>
SplashScreen.java
public class SplashScreen extends Activity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo/company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashScreen.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
的[XML佈局的變化,而可能的複製改變方向](http://stackoverflow.com/questions/9630952/xml-layout-changes-while-changing-orientation) – Yazan
It's Working ..謝謝你soo .. Answare標記:D –