XML ファイルの右側から左側に要素を入力したい線形レイアウトがあります。右から左に埋める理由は、右辺のレイアウトに合わせたいので丸め誤差%です。
1つは次のように分離されています。55% - 15% - 15% - 15%
もう1つは次のとおりです。49% - 2% - 34% - 15%
そして、私が望むのは、正しい 15% がまったく同じであることだけです。なぜなら、今は同じではないからです (おそらく 1px または 2px の違い)。
方向と重力を試しましたが、望ましい結果が得られませんでした。
編集:
申し訳ありませんが、ここに私のコードがあります:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false"
android:weightSum="100">
<RelativeLayout
android:id="@+id/leftSideDefaultHoldeTitleBar"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="49"
android:background="@android:color/holo_green_dark">
</RelativeLayout>
<RelativeLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@android:color/darker_gray">
</RelativeLayout>
<RelativeLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="34"
android:background="@android:color/black">
</RelativeLayout>
<RelativeLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="15"
android:background="@android:color/blue"
>
</RelativeLayout>
</LinearLayout>
他のレイアウトは重量の値が違うだけで同じです。同じホルダーにブースを置いて、切り替えると右側が少しずれます。