SwipeRefreshLayout
内有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>
我想为它添加上边距:
FrameLayout.LayoutParams ps = (FrameLayout.LayoutParams) mRefreshLayout.getLayoutParams();
ps.topMargin = 40;
mRefreshLayout.setLayoutParams(ps);
mRefreshLayout.requestLayout();
在Android 4.0+上运行正常。但是在Android 2.3而不是顶级边距上,我看到机器人边缘。真的无法理解会发生什么。有什么建议吗?
如果我将FrameLayout
更改为RelativeLayout
,那么它无处不在......