Space between image and content Android studio

Asked

Viewed 408 times

0

I am developing a mobile application using android studio 2.2.2 and wanted to leave my application with this look.

inserir a descrição da imagem aqui

But I’m not getting , by placing the image it gets a space between the image and the Textview from above and below.

inserir a descrição da imagem aqui

<?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"
android:orientation="vertical"
tools:context="com.example.tulio.exercicio3.MainActivity">


<TextView
    android:id="@+id/Lamborghini"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/holo_green_dark"
    android:text="Lamborghini"
    android:textAlignment="center"
    android:textColor="#ffffff"
    android:textSize="50sp" />

<ImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="272dp"
    android:layout_weight="3"
    app:srcCompat="@drawable/lamborghini" />


<TextView
    android:id="@+id/aventador"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/darker_gray"
    android:text="Aventador"
    android:textAlignment="center"
    android:textColor="@android:color/holo_red_dark"
    android:textSize="36sp" />

<TextView
    android:id="@+id/preco"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/darker_gray"
    android:text="R$ 434,000"
    android:textAlignment="center"
    android:textColor="@android:color/holo_red_dark"
    android:textSize="36sp" />


    </LinearLayout>

1 answer

1


Add

android:scaleType="centerCrop"

In your imageview, to stay the way you want, the image needs to be cropped and centered

Browser other questions tagged

You are not signed in. Login or sign up in order to post.