我通過網絡服務解析數據。我想要水平翻轉而不是垂直翻轉。這裏是一個教程,其中使用ViewFlipper,但它是用於靜態數據。如何在Android中製作動態翻轉屏幕(如iPhone)
這裏是我們的代碼,我們需要2個活動之間翻轉:
Splash.java
public class Splash extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startActivity(new Intent(Splash.this, MainMenu.class));
Splash.this.finish();
}
}
Splash.xml
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/splash">
</AbsoluteLayout>
Menu.java
public class Menu extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
}
}
menu.xml文件
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/menu">
</AbsoluteLayout>
你是什麼意思「這是第一個使用ViewFlipper教程」? – 2011-12-20 14:17:56
檢查這個[答案](http://stackoverflow.com/questions/2651360/how-to-provide-animation-when-calling-another-activity-in-android/2651890#2651890) – Praveen 2010-04-19 13:59:44