I am working on an Android card game. I want to display all the players cards, and so I created 4 LinearLayouts. 1 for top player, left side player, right side player, and the bottom player.
I am trying to use the same images for the cards, and therefor I try to rotate the cards of the side players (left and right players).
For some reason, the top and bottom players cards looks good, but the side players cards are too small.
This is my left player layout:
<LinearLayout
android:id="@+id/leftParentLayout"
android:layout_width="80dp"
android:layout_height="200dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.026"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.381">
<ImageView
android:id="@+id/player_left_card_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:clickable="false"
android:paddingBottom="1dp"
android:paddingEnd="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:rotation="90" />
<ImageView
android:id="@+id/player_left_card_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:clickable="false"
android:paddingBottom="1dp"
android:paddingEnd="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:rotation="90" />
<ImageView
android:id="@+id/player_left_card_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:clickable="false"
android:paddingBottom="1dp"
android:paddingEnd="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:rotation="90" />
<ImageView
android:id="@+id/player_left_card_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:clickable="false"
android:paddingBottom="1dp"
android:paddingEnd="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:rotation="90" />
<ImageView
android:id="@+id/player_left_card_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:clickable="false"
android:paddingBottom="1dp"
android:paddingEnd="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:rotation="90" />
</LinearLayout>
Although the height should be 200 and width 80, the cards are smaller. I suspect the card sizes are being calculated before the rotation, and then the rotation shrinks them somehow, it seems like the cards width of the left player is the same width as the top player, but it should be bigger because of the rotation.
How can I rotate the cards, but keep them at their original size? Thanks.
Here is a screenshot from the game.