大虾们好:
   小弟碰到一个问题,是写的main.xml中布局写好了,但当切为横屏的时候在viewfilpper 布局中的width 却只占屏幕的2/3
以下是我的布局文件<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"
    android:id="@+id/main"
    >
    <ViewFlipper 
  android:id="@+id/ViewFlipper01"  
        android:layout_width="fill_parent" 
        android:layout_height="380dip"
        >  
</ViewFlipper> 
<LinearLayout
android:orientation="horizontal"
  android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:layout_gravity="bottom"
    android:gravity="bottom"
    android:background="@drawable/buttonbar" >
    <Button
     android:layout_width="50dip"
     android:layout_height="50dip"
     android:id="@+id/menu_list"
     android:layout_marginLeft="2dip"
     android:background="@drawable/bottom_menu"
     />
</LinearLayout>
 
</FrameLayout>
下面的按钮条宽度到是在切换的时候能占满宽度,在ViewFillper里面装的是ScrollView 求解

解决方案 »

  1.   

    这个问题很好结局 创建两个xml文件 在oncreate方法及里面写个判断就OK了! if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
             setContentView(R.layout.a1);
             }         else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {         setContentView(R.layout.a1);         } 创建两个 layout-land和layout-port文件 在运行的时候程序会自动判断横竖屏