0

I have SwipeRefreshLayout inside FrameLayout:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_gradient"
    android:orientation="vertical" >

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/fr_projects_refresh_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        [...]
   </android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>

And i want to add top margin for it:

FrameLayout.LayoutParams ps = (FrameLayout.LayoutParams) mRefreshLayout.getLayoutParams(); 
ps.topMargin = 40;
mRefreshLayout.setLayoutParams(ps);
mRefreshLayout.requestLayout();

It works fine on Android 4.0+. But on Android 2.3 instead of top margin i see bot margin. And really can't understand what happens. Any suggestions?

If i change FrameLayout to RelativeLayout it works fine everywhere...

0 Answers0