2012-08-17 118 views
0

我創建了一個action_bar.xml佈局文件。我在哪裏實施可擴展列表視圖和2個按鈕。如圖所示,但問題是整個可擴展列表視圖出現在actionBar端。 我的佈局文件ActionBar的Android自定義佈局

<?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" 
    android:gravity="fill_vertical" 
    android:orientation="horizontal" > 

    <Button 
     android:id="@+id/button3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:text="Button" /> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:text="Button" /> 

    <ExpandableListView 
     android:id="@+id/expandableListView1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" > 
    </ExpandableListView> 

</RelativeLayout> 

我想顯示在屏幕康比利的可膨脹的ListView。

回答

0

ExpandableListView出現在ActionBar中,因爲它是使用ActionBar尺寸誇大顯示的操作欄自定義佈局的一部分。

另一種方法是設定點擊偵聽器按鈕中的一個,然後顯示列表視圖作爲popup control.