私はweightSumとLayoutWidthを理解することに問題があるようです。私のコードは以下の通りです:アンドロイドでweightSumでレイアウトを分割する方法は?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="3">
<LinearLayout
android:background="#cccccc"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:padding="20sp"
android:textSize="30sp"
android:gravity="center_horizontal"
android:text="Cheapest Fare Option"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:background="#666666"
android:layout_weight="2"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout>
本の私の理解では、スペースの2/3がかかります第一レイアウトはスペースと第二のレイアウトの1/3を取るだろうが、その逆が起こっている、すなわち第一レイアウトです2/3をとり、2番目のレイアウトは1/3になります
どうしてですか?これを理解しようと努力しています。あなたのandroid:orientation="vertical"
を取る
素晴らしい、ありがとう! upvoteを表示するには十分な評判がない! – zooter