Android 以编程方式阻止布局传递?

Android 以编程方式阻止布局传递?,android,android-layout,android-widget,Android,Android Layout,Android Widget,这是我的视图层次结构: -RelativeLayout[rootView](根) 线性布局[菜单固定器](菜单片段布局) RelativeLayout[应用程序持有者](应用程序内容布局) 操作栏(自定义视图以实现操作栏

这是我的视图层次结构:

-RelativeLayout[rootView](根)

  • 线性布局[菜单固定器](菜单片段布局)

  • RelativeLayout[应用程序持有者](应用程序内容布局)

    • 操作栏(自定义视图以实现操作栏<2.1

    • FrameLayout[内容片段](用于加载内容片段的布局)

    • 浮动菜单(显示浮动小部件的自定义线性布局)


现在,我将菜单和应用程序都加载到根视图中,这样应用程序保持在顶部。现在,当用户按下菜单按钮时,应用程序保持器向右滑动,以在左侧显示基础菜单片段,如下图所示:

我使用了一个内置的runnable来向右滑动app_支架。在偏移app_支架后,我还每隔16毫秒在rootView上调用invalidate()

它工作正常,但当任何内容加载到content_片段(可见性集或从web加载)中时,当菜单片段可见时,问题就出现了下面的布局调用会将app_holder重置为其初始位置。我已经在我的content_片段上实现了延迟加载listview,因此listview上的任何更新(notifyDataSetChanged等)都会启动重新启动调用

如何阻止这种情况发生


在右侧所有动态加载的视图上覆盖并注释requestLayout()将解决此问题,但还有其他合适的方法吗?

您能详细说明您的问题吗?
<com.example.app.views.widgets.RootLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drag_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white" >

    <LinearLayout
       android:id="@+id/menu_holder"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:background="@color/red"
       android:orientation="vertical" />

    <com.example.app.views.widgets.AppHolder
    android:id="@+id/app_holder"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/gray" >

    <com.example.app.widgets.ActionBar
        android:id="@+id/action_bar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <FrameLayout
        android:id="@+id/content_holder"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/action_bar"
        android:background="@drawable/backrepeat" >
    </FrameLayout>

    <com.example.app.widgets.FloatingMenu
        android:id="@+id/floating_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:padding="15dp"
        android:visibility="gone" />
    </com.example.app.views.widgets.AppHolder>
</com.example.app.views.widgets.RootLayout>