2013-07-23 25 views
0

我有三個垂直排列的控件,列表視圖,菜單按鈕和隱藏菜單。 列表視圖將佔據整個屏幕並且菜單按鈕將被粘貼到屏幕的底部。當我們觸摸菜單按鈕時,隱藏菜單將向上滑動並佔據近一半的屏幕。隱藏菜單不會覆蓋整個屏幕。如何安排佈局和哪些佈局用於FB菜單效果

我可以使用哪些佈局以及如何安排?

增加了額外信息。

下面是我測試的xml佈局。如果我發送了屏幕外我的子菜單,列表數據未加載,我認爲這是因爲它沒有顯示在屏幕上。

<RelativeLayout 
     android:id="@+id/content_layout" 
     android:layout_width="match_parent" 
     android:layout_height="fill_parent" 
     android:layout_below="@+id/header_layout" 
     android:background="#ffffff" > 

     <ExpandableListView 
       android:id="@+id/listview_Category" 
       android:layout_width="match_parent" 
       android:layout_height="500dp" 
       android:divider="#E5E5E5" 
       android:dividerHeight="1dp" 
       android:background="#aaaaaa" 
       tools:listitem="@layout/list_item" 
       > 
      </ExpandableListView> 

      <ImageButton 
       android:id="@+id/imageButtonMenu" 
       android:layout_width="match_parent" 
       android:layout_height="40dp" 
       android:layout_alignParentBottom="true" 
       android:layout_gravity="center_horizontal" 
       android:contentDescription="@string/app_name" 
       android:src="@drawable/menu_icon" /> 

      <ListView 
       android:id="@+id/listview_Cat" 
       android:layout_width="match_parent" 
       android:layout_height="500dp" 
       android:layout_toEndOf="@+id/imageButtonMenu" 
       android:background="#777777" 
       android:divider="#ffffff" 
       android:dividerHeight="1dp" 
       android:translationY="500dp" 
       tools:listitem="@layout/category_list_item" > 
      </ListView> 
    </RelativeLayout> 

+0

use this https://github.com/i8ramin/fb-menu –

+0

試試這個:http://stackoverflow.com/questions/16338647/framelayout-is-it-possible-to-put-child-layout- off-screen –

回答

0

可以使用的幀結構,其中,列表視圖覆蓋整個佈局和菜單按鈕是底部對齊,菜單有一個固定的寬度和高度...

,但因爲它是一個滑動您正在尋找的菜單還可以使用導航抽屜在最新版本的android中引入。

+0

下面是我的示例xml佈局,,,「listview_Cat」是隱藏的菜單。當我將它的位置設置在屏幕外時,列表數據不會被加載。例如toEndOf。 – C0der