Reputation: 11
I keep getting crashed everytime i run the code, i tried to remove the CardView codes and it's not crashed anymore. Can u help me guys, since im new to this environment and currently im working on a project, am i doing it wrong with the cardView codes?. Thanks
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bgapps"
tools:context=".utama">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<androidx.cardview.widget.CardView
android:id="@+id/cardCam"
android:layout_width="120dp"
android:layout_height="125dp"
android:layout_below="@+id/cardPupuk"
android:layout_marginStart="125dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="@+id/soilIv"
app:cardBackgroundColor="#989595"
app:cardCornerRadius="12dp">
<ImageView
android:id="@+id/camIv"
android:layout_width="71dp"
android:layout_height="71dp"
android:layout_gravity="center"
android:src="@drawable/cam" />
</androidx.cardview.widget.CardView>
</RelativeLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Upvotes: 0
Views: 381
Reputation: 75778
android:layout_marginEnd
Specifies extra space on the end side of this view. This space is outside this view's bounds. Margin values should be positive.
You should use proper value in androidx.cardview.widget.CardView
section.
Don't
android:layout_marginEnd="@+id/soilIv"
It should be
android:layout_marginEnd="10dp"
Upvotes: 2