Note that there are some explanatory texts on larger screens.

plurals
  1. POBlock layout pass programmatically?
    primarykey
    data
    text
    <p>This is my View Hierarchy:</p> <p>-RelativeLayout [rootView] (root)</p> <ul> <li><p>LinearLayout [menu_holder] (menu fragment layout)</p></li> <li><p>RelativeLayout [app_holder] (app content layout)</p> <ul> <li><p>Action Bar (custom view to implement ActionBar &lt; 2.1</p></li> <li><p>FrameLayout [content_fragment] (layout to load content fragment)</p></li> <li><p>FloatingMenu (custom LinearLayout to show a floating widget)</p></li> </ul></li> </ul> <pre><code>&lt;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" &gt; &lt;LinearLayout android:id="@+id/menu_holder" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/red" android:orientation="vertical" /&gt; &lt;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" &gt; &lt;com.example.app.widgets.ActionBar android:id="@+id/action_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;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" &gt; &lt;/FrameLayout&gt; &lt;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" /&gt; &lt;/com.example.app.views.widgets.AppHolder&gt; &lt;/com.example.app.views.widgets.RootLayout&gt; </code></pre> <p>Now I load both menu_holder &amp; app_holder into the rootView, such that app_holder stays on top. Now when the user presses MENU button, app_holder slides towards right to show the underlying menu fragment on the left, like in the picture below:</p> <p><img src="https://i.stack.imgur.com/1esP6.png" alt="enter image description here"></p> <p>I have used a <a href="http://developer.android.com/reference/android/widget/Scroller.html" rel="nofollow noreferrer">scroller</a> inside a runnable to slide app_holder towards right. I also call invalidate() every 16ms on the rootView after offsetting my app_holder. </p> <p>Its working fine, but problem comes when any content gets loaded in the content_fragment (visibility set or loaded from web), when the menu fragment is visible. The invalidated view (out of bounds) calls requestLayout() and the following layout call resets the app_holder to its initial position. I have implemented lazy loading listviews on my content_fragment, so any update on the listview (notifyDataSetChanged etc.) initiates a relayout call. </p> <p>How to stop this from occurring ? </p> <p>Overriding and commenting requestLayout() on all dynamically loaded views on the right will fix the issue, but is there any other proper way ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload