SlidingMenu showSecondaryMenu无法正常工作

时间:2013-06-24 13:42:25

标签: android android-layout android-fragments slidingmenu

我正在为Android使用SlidingMenu库(https://github.com/jfeinstein10/SlidingMenu)。

我有一个左右菜单,当使用滑动手势或toggle()方法打开时左边工作正常。问题在于右键菜单,使用滑动打开时效果很好,但是当调用showSecondaryMenu()时,它只是膨胀菜单的布局,但不允许我点击任何组件。

这是辅助菜单的布局:

<?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"
android:orientation="vertical"
android:id="@+id/search_sliding_menu_layout" >

<EditText
    android:id="@+id/search_sliding_menu_edittext_search"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Search"
    android:drawableLeft="@drawable/ic_action_search"
    android:ems="10" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/search_sliding_menu_textview_filter_subtitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="@string/search_sliding_layout_subtitle" />

<ExpandableListView
    android:id="@+id/search_sliding_menu_expandablelistview_filters"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    >
</ExpandableListView>

<Button
    android:id="@+id/search_sliding_layout_btn_filter"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="@string/search_sliding_layout_btn_filter" 
   />

</LinearLayout>

这是片段的onCreateView:

 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle         savedInstanceState) {
    // Inflate the layout for this fragment
    View convertView = inflater.inflate(R.layout.search_sliding_menu_layout, null);
    filters = (ExpandableListView)convertView.findViewById(R.id.search_sliding_menu_expandablelistview_filters);
    filter_btn = (Button)convertView.findViewById(R.id.search_sliding_layout_btn_filter);
    claimSearch = (EditText)convertView.findViewById(R.id.search_sliding_menu_edittext_search);
    return convertView;
}

这就是我打电话的方式,我从活动中启动了一个菜单:

getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
getSupportFragmentManager()
    .beginTransaction()
    .replace(R.id.menu_frame_two,  new MyFragment())
    .commit();
getSlidingMenu().showSecondaryMenu();

0 个答案:

没有答案