-1
I made a login screen with Contraintlayout, in the editor of android studio appears with the margin as I specified, but in emulator and device appears without the margin:
<?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"
tools:context=".activities.LoginActivity">
<ImageView
android:id="@+id/actLogin..."
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginTop="86dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_...." />
<TextView
android:id="@+id/actLoginTv..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif-black"
android:text="@string/app_name"
android:textColor="@color/colorPrimary"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/actLogin..." />
<EditText
android:id="@+id/etActLoginEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:drawableStart="@drawable/ic_email"
android:drawablePadding="8dp"
android:ems="10"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/actLoginTv..." />
<EditText
android:id="@+id/etActLoginPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:drawableStart="@drawable/ic_lock"
android:drawablePadding="8dp"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:maxLength="16"
android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etActLoginEmail" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnActLoginSignUp"
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="32dp"
android:onClick="onSignUpClicked"
android:text="@string/sign_up"
app:backgroundTint="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etActLoginPassword" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnActLoginSignIn"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="195dp"
android:layout_marginEnd="32dp"
android:onClick="onSignInClicked"
android:text="@string/sign_in"
app:layout_constraintBottom_toBottomOf="@+id/btnActLoginSignUp"
app:layout_constraintEnd_toStartOf="@+id/btnActLoginSignUp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/btnActLoginSignUp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Why do the edges of the buttons disappear on the practice screen? Some ids I hid the name for security reasons
What image format are you calling in app:srcCompat="@drawable/ic_...."?
– juliano santos
@julianosantos all the Assets I use in the app is SVG
– Samuel Ives