0
現在、画面の幅を均等に分割するために、重み付けされたLinearLayout
を使用しようとしています。それらの半分の1つで、私はRatingBar
を中心に直接配置したかったのです。私が現在持っているレイアウトは以下の通りです:Weighted LinearLayout内に表示されたときにRatingBarが水平に切り取られました
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<RatingBar
android:id="@+id/rating_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="true"
android:max="5"
android:numStars="5"
android:scaleX="0.5"
android:scaleY="0.5"
tools:rating="3" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test" />
</LinearLayout>
</LinearLayout>
私が発見しています問題はRatingBar
が水平に切断し、わずか3.5つ星を示しているということです。私がRatingBar
を加重値LinearLayout
から移動すると、私は予想通りに表示します。私は、均等に画面を分割する別の方法は、重み付けを使用する以外にはわかりません。重みを付けずに画面を均等に分割する方法、またはRatingBar
を正しく内部に表示する方法は、非常に高く評価されます。