我试图在添加 fragment 时让我的弹出菜单正常工作。 所以,由于这段代码,我有一个弹出菜单可以工作:
https://github.com/garuma/FlyOutMenu/tree/master/FlyOutMenu
<com.myApp.FlyOutContainer xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/FlyOutContainer">
<include
layout="@layout/menu_layout"
android:id="@+id/menu_layout" />
<include
layout="@layout/content_layout"
android:id="@+id/content_layout" />
</comm.myApp.FlyOutContainer>
在我的应用程序开始时,content_layout
由以下布局组成:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
layout="@layout/top_bar_layout"
android:id="@+id/top_bar_layout" />
<include
layout="@layout/root_layout"
android:id="@+id/root_layout" />
</LinearLayout>
启动后,我的 Activity 在 root_layout 中添加一个 fragment :
// Create new fragment and transaction
Fragment questionListFragment = new QuestionListFragment();
FragmentTransaction transaction = FragmentManager.BeginTransaction();
transaction.Add(Resource.Id.root_layout, questionListFragment);
// Commit the transaction
transaction.Commit();
这个新 fragment 包含滑动刷新布局和 ListView 。 当我从左向右滑动时,菜单显示良好。但要隐藏它(从右向左滑动),背景菜单。
更新:
我认为问题出在 notifyDataSetChanged 上。当菜单打开时,我的 View 不居中,我更新了我的 ListView 。所以在更新时,我的 View 被重新创建并重新居中,菜单留在后台...... 我该如何解决?
这里是截图来理解: (我还不能在 stackOverflow 上发布图片,而且不超过 2 个链接...)
问题是:
最佳答案
我建议使用标准导航绘制。你可以在这里找到我的例子:https://github.com/jamesmontemagno/Xam.NavDrawer
关于android - 添加 fragment 时 FlyOut 菜单设计问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29880787/