2016-08-29 71 views
0

我正在開發一個UI,我只想在一個活動中添加兩個FrameLayout。我想要一個FrameLayout填充父窗體(全屏)佈局,另一個FrameLayout放置在第一個佈局上。主要是我想在每個屏幕上的整個應用程序中修整圓弧。如何在單個屏幕中添加兩個FrameLayout

enter image description here enter image description here

  <?xml version="1.0" encoding="utf-8"?> 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

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

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

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/home_menu" 
      android:layout_weight="1" 
      android:src="@drawable/ic_home"/> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/dis__menu" 
      android:layout_weight="1" 
      android:src="@drawable/ic_home"/> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/gallery_menu" 
      android:layout_weight="1" 
      android:src="@drawable/ic_home"/> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/download_menu" 
      android:layout_weight="1" 
      android:src="@drawable/ic_home"/> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/price_menu" 
      android:layout_weight="1" 
      android:src="@drawable/ic_home" /> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/feedb_menu" 
      android:layout_weight="1" 
      android:src="@drawable/ic_home"/> 

     </LinearLayout> 
     <FrameLayout 
      android:id="@+id/container_body" 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1"> 
     </FrameLayout> 
     </LinearLayout> 
     </LinearLayout> 

以上代碼劃分爲兩個部分畫面,我想放在容器本體的FrameLayout菜單。

+0

我已經嘗試在線性佈局中的兩個框架佈局。購買我想在全屏幕中顯示一個框架佈局,並在另一個框架上顯示菜單 –

回答

0

使用相對佈局而不是線性佈局作爲父佈局,並且不要過多地嵌套佈局,需要更多時間才能呈現嵌套佈局。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<FrameLayout 
    android:id="@+id/container_body" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/darkGrey"></FrameLayout> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:background="@color/blockBtnColor" 
    android:orientation="vertical"> 

    <ImageView 
     android:id="@+id/home_menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:src="@drawable/ic_home" /> 

    <ImageView 
     android:id="@+id/dis__menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:src="@drawable/ic_home" /> 

    <ImageView 
     android:id="@+id/gallery_menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:src="@drawable/ic_home" /> 

    <ImageView 
     android:id="@+id/download_menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:src="@drawable/ic_home" /> 

    <ImageView 
     android:id="@+id/price_menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:src="@drawable/ic_home" /> 

    <ImageView 
     android:id="@+id/feedb_menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:src="@drawable/ic_home" /> 

</LinearLayout> 

</RelativeLayout> 

試試這個。

相關問題