2016-11-20 65 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文件夾應該是一樣的。