android studio: Imagebutton display inconsistent across different devices

6 Views Asked by At

I have an issue in Android Studio where an ImageButton is displaying differently on different devices. The behaviour is as expected on a Samsung S20 whereas with on a Samsung A21s the button is surrounded by a grey background, resulting in other items being pushed off the screen.

The expected behaviour: The issue:

The button is in a linear layout and is defined thus: <androidx.appcompat.widget.AppCompatImageButton android:id="@+id/btn_keypad" android:layout_width="250sp" android:layout_height="145sp" android:layout_gravity="center" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:srcCompat="@drawable/ic_phone_keypad" style="@style/Widget.AppCompat.Button.Borderless" android:contentDescription="@string/keypad_image" />

Can anyone help me figure out why this is happening?

0

There are 0 best solutions below