添加片段时 FlyOut 菜单设计问题
FlyOut menu design issue when adding 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中添加一个片段:
// 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();
这个新片段包含滑动刷新布局和列表视图。
当我从左向右滑动时,菜单显示良好。但要隐藏它(从右向左滑动),后台菜单。
更新:
我认为问题出在 notifyDataSetChanged 上。当菜单打开时,我的视图不居中,我更新了我的列表视图。所以在更新时,我的视图被重新创建并重新居中,菜单留在后台......
我该如何解决?
这里截图了解下:
(我还不能在 Whosebug 上 post 图片,并且不超过 2 个链接...)
这是问题所在:
我建议使用标准导航绘制。你可以在这里找到我的例子:https://github.com/jamesmontemagno/Xam.NavDrawer
我试图在添加片段时让我的弹出菜单正常工作。 所以,由于这段代码,我有一个弹出菜单可以工作:
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中添加一个片段:
// 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();
这个新片段包含滑动刷新布局和列表视图。 当我从左向右滑动时,菜单显示良好。但要隐藏它(从右向左滑动),后台菜单。
更新:
我认为问题出在 notifyDataSetChanged 上。当菜单打开时,我的视图不居中,我更新了我的列表视图。所以在更新时,我的视图被重新创建并重新居中,菜单留在后台...... 我该如何解决?
这里截图了解下: (我还不能在 Whosebug 上 post 图片,并且不超过 2 个链接...)
这是问题所在:
我建议使用标准导航绘制。你可以在这里找到我的例子:https://github.com/jamesmontemagno/Xam.NavDrawer