I have an activity with three rectangle CardViews. I have set the size constraints such that they change according to the screen resolution. Please view my constraints here.
The problem is that the CardViews are not changing their size proportionally. For example, when I run my application on a Nexus 5 (1080 x 1920), the bottom component gets cut in half, where as if I run on a Pixel (also 1080 x 1920), the bottom component is the desired size.
Although I will try to make the post as clear as possible, the pictures definitely help understand the problem I am facing, so please view them.
..
Why is the bottom component changing so drastically when the screen sizes are very similar? How can I modify the components so that they are the desired size for these different screen sizes?
I know that you are able to create small, normal, large, and xlarge layouts, and I have but I don't think this is what the problem is.
Code for the 3 CardViews:
Top left
<android.support.v7.widget.CardView
android:id="@+id/capture_receipt_cardview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/margin_width_normal"
android:layout_marginEnd="@dimen/button_gap_normal"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:layout_constraintBottom_toBottomOf="@+id/create_invoice_cardview"
app:layout_constraintEnd_toStartOf="@+id/create_invoice_cardview"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/create_invoice_cardview">
</android.support.v7.widget.CardView>
Top Right:
<android.support.v7.widget.CardView
android:id="@+id/create_invoice_cardview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/button_gap_normal"
android:layout_marginTop="185dp"
android:layout_marginEnd="@dimen/margin_width_normal"
android:layout_marginBottom="@dimen/button_gap_normal"
app:layout_constraintBottom_toTopOf="@+id/add_single_cardview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/capture_receipt_cardview"
app:layout_constraintTop_toTopOf="parent">
</android.support.v7.widget.CardView>
Bottom Horizontal:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/add_single_cardview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="400dp"
android:layout_marginBottom="68dp"
app:layout_constraintBottom_toTopOf="@+id/navigation"
app:layout_constraintEnd_toEndOf="@+id/create_invoice_cardview"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/capture_receipt_cardview"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:layout_constraintVertical_weight="0">
</android.support.v7.widget.CardView>