我需要在Android布局方面以外得到一些帮助。比如说:
实际上,我使用了daily.xml这个视图。这个视图包含一个flipper,并且通过编程方式填充了5个ListView,以便用户可以进行翻转。
现在,我想添加一个横屏模式。在这种模式下,我不需要翻转器,因为有足够的空间在水平线性布局中显示所有的ListView。所以我创建了一个layout-land资源文件夹并添加了另一个daily.xml。
实际上,我使用了daily.xml这个视图。这个视图包含一个flipper,并且通过编程方式填充了5个ListView,以便用户可以进行翻转。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/background">
<de.oszimtcc.timetableview.TimetableFlipperView
android:id="@+id/flipper"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_margin="20dp"
android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent" >
</de.oszimtcc.timetableview.TimetableFlipperView>
</LinearLayout>
在TimetableScreen.java中的Flipper
activity.setContentView(R.layout.daily);
Log.i(TimetableApplication.LOG_TAG,"Start create Timetable-Aplication");
activity.setContentView(R.layout.daily);
activity.inflater = LayoutInflater.from(this.activity);
flipper = (TimetableFlipperView) activity.findViewById(R.id.flipper);
dayListView = (ListView) activity.findViewById(R.id.dayListView);
flipper.AddContent(**Content to show **);
现在,我想添加一个横屏模式。在这种模式下,我不需要翻转器,因为有足够的空间在水平线性布局中显示所有的ListView。所以我创建了一个layout-land资源文件夹并添加了另一个daily.xml。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/background">
<de.oszimtcc.timetableview.BlockListView
android:id="@+id/dayListViewMonday"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="5dp"
android:listSelector="@drawable/day_selector"
android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent">
</de.oszimtcc.timetableview.BlockListView>
...the same ListView again for 4 times, with different android:id...
</LinearLayout>
但是我该如何在我的TimetableScreen.java类中处理它?因为没有翻转器,我不能使用默认构造函数来初始化类。我应该在每次调用onCreate时调用不同的方法,还是有更好的方法来处理它呢?
非常感谢您,Kooki!