Home > Mobile >  Constrained image button images way too zoomed in
Constrained image button images way too zoomed in

Time:09-07

So I'm working on an app where I have 4 image buttons, but for some reason, the images are very zoomed in. Any ideas?

folder

    <?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:id="@ id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<ImageButton
    android:id="@ id/imageButton1"
    android:layout_width="150dp"
    android:layout_height="150dp"
    android:layout_marginEnd="520dp"
    android:onClick="Click1"
    android:src="@drawable/placeholder1"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:ignore="SpeakableTextPresentCheck"
    tools:srcCompat="@drawable/placeholder1" />

CodePudding user response:

Found the answer. Needed to add either of these tags to each button:

android:scaleType="centerInside"

android:scaleType="fitXY"
  • Related