更新时间:2023-01-24 12:53:47
对此有一个非常简单的解决方案.只需将布局放入内部,例如FrameLayout
,然后在外部布局元素上设置适当的填充即可.然后,所有api的所有内容都将看起来相同:
There's one really simple solution to this. Just put your layout inside, for example a FrameLayout
and set appropriate paddings on the outer layout element. Then everything is gonna look the same across all apis:
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/defaultMargin"
android:paddingRight="@dimen/defaultMargin">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
</FrameLayout>