大佬教程收集整理的这篇文章主要介绍了android – 不同的屏幕方向,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
实际上我使用了一个名为daily.xml的视图.这个视图包含一个翻页器,如果用户需要,它将以编程方式填充5个ListViews来翻转.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://scheR_60_11845@as.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中的翻转器
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 **);
现在,我想添加一个landscapemode.在这些模式中,我不会hava这样的鳍状肢,因为有足够的空间在水平线性布局上显示所有ListViews.所以我创建了一个布局 – 土地资源 – 文件夹,每天添加另一个. XML
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://scheR_60_11845@as.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!
activity.setContentView(R.layout.daily); Log.i(TiMetableApplication.LOG_TAG,"Start create TiMetable-Aplication"); activity.setContentView(R.layout.daily); if(getresources().getConfiguration().orientation == Configuration.oRIENTATION_POTraiT) { //check this statement 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 **); } else { //Code for Landscape mode }
以上是大佬教程为你收集整理的android – 不同的屏幕方向全部内容,希望文章能够帮你解决android – 不同的屏幕方向所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。