2
How do I align an image in the center of the screen on Android? I’m using the code below, but it’s centered at the top of the screen:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="br.com.projeto.acessosistema.SplashActitivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="60dp"
android:contentDescription="@string/logomarca"
app:srcCompat="@drawable/logo" />
</LinearLayout>
I got it, I switched android:layout_gravity="center_horizontal" by android:layout_gravity="center"
– user24136
That’s right! Please mark the answer as correct!
– Túlio Calazans
Sorry Tulio for the delay. I marked as correct answer. Thank you.
– user24136