如果不使用绝对宽度,如何使子视图比父视图宽?
以下XML导致子视图维度受到父级约束。
<RelativeLayout 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" >
<LinearLayout
android:layout_width="800dp"
android:layout_height="800dp"
android:background="@drawable/red_border" />
</RelativeLayout>
如果我为父布局设置了绝对宽度,那么孩子就不会受到约束。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="800dp"
android:layout_height="800dp" >
<LinearLayout
android:layout_width="800dp"
android:layout_height="800dp"
android:background="@drawable/red_border" />
</RelativeLayout>