1

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

我有一个左右菜单,当使用滑动手势或切换()方法打开时,左侧工作正常。问题出在右侧菜单上,通过滑动打开时它工作正常,但在调用 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;
}

这就是我所说的我从活动中启动 rigth 菜单的方式:

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

0 回答 0