我有一个布局,想要使用layout_weight(1:2)将其分成两个视图。但是,我希望左侧视图至少有400dp的宽度。
例如,如果左侧视图使用权重达到420dp宽度,则保持不变,但如果小于400dp,则让它保持为400dp并将其他视图全部给予余下的宽度。
这是我尝试过但并没有成功的布局:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:minWidth="400dp"
android:background="@android:color/holo_blue_bright"/>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@android:color/holo_green_light"/>
</LinearLayout>
请帮忙, 谢谢!