2016-11-20 68 views
0

我的用户界面看起来像在横向模式:Android的横向模式很糟糕

enter image description here

但我想有他们在平行。所以应该有宽度/ 2而不是高度/ 2.那么我该如何改变它呢?

我的代码看起来像这样:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#ffffff"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/photo" 
      android:layout_weight="0.5" 
      android:id="@+id/btnTakePhoto" /> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/video" 
      android:layout_weight="0.5" 
      android:id="@+id/btnRecordVideo" 
      /> 

    </LinearLayout> 
</FrameLayout> 

预先感谢您的帮助!

+1

如果我正确理解你的问题,你可以将'LinearLayout'的方向设置为'horizo​​ntal':'android:orientation =“horizo​​ntal”' – antonio

+0

谢谢,不知道这很容易! – mafioso

回答

0

添加布局,土地文件夹中水库中的应用程序目录,并设计了XML的文件夹同名此文件夹中。 Android框架将检测模式,并将选择layout-land文件夹中定义的布局文件。

*记得xml文件名布局和layout-land文件夹应该是一样的。