1

This feels like a silly question, but i'm still a bit of a noob so.... I'm trying to get my EditText to look like this:

enter image description here

And it works fine on most devices, using this as a background for the editText:

<?xml version="1.0" encoding="utf-8"?>
<!--  res/drawable/rounded_button.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle" android:padding="10dp">
  <solid android:color="@color/colorTextfield"/>
  <corners
    android:bottomRightRadius="40dp"
    android:bottomLeftRadius="40dp"
    android:topLeftRadius="40dp"
    android:topRightRadius="40dp"/>
</shape>

However, on some devices (I have an old, low-res testing device here) I get this instead: enter image description here

Note how the edges are super stretched. It really doesn't look nice. I'm guessing the one solution is to make a style file especially for low-res devices (I'll try that in the meantime), but I was wondering if there was a better way to do this, without having multiple files in which I need to guess what the radius should be for each res. I only have a limited amount of testing devices, and I'm worried I get it wrong.

Zee
  • 1,592
  • 12
  • 26
  • 1
    That is happening because of the aspect ratio of that screen, and how Android is made. Android is used by a lot of manufacturers and is used in many different devices, so this is something that happens a lot when I'm building apps. One thing you could try creating a [nine-patch](https://developer.android.com/studio/write/draw9patch) and then applying it to your edittext (like [this](https://stackoverflow.com/a/15910327/7671879)) but I think the result will be the same. – miguelarc Jun 13 '18 at 08:35
  • Other option is to change the radius on low-res devices – Eselfar Jun 13 '18 at 09:03

0 Answers0