1

For some reason the android:paddingLeft and/or android:paddingStart I am using in my layout file is not working when I run it on my device (HTC One M8). I have tried a combination of android:paddingLeft with android:paddingStart, as well as both by themselves.

<EditText
        android:id="@+id/editText_Username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/imageView1"
        android:layout_alignStart="@+id/imageView1"
        android:layout_alignLeft="@id/imageView1"
        android:background="@drawable/textlines"
        android:ems="10"
        android:hint="@string/username"
        android:singleLine="true"
        android:paddingLeft="10dp"
        android:textColorHint="@color/s_red" />

Here are some links to screenshots that I have taken. (Sorry first post, I do not have the reputation to upload images).

https://i.stack.imgur.com/FMpmJ.jpg

I have tried using a different device (Samsung Galaxy S4) as well as building it from different systems but I keep getting the same issue.

Any help is greatly appreciated, thank you!

Edit:

As per Kirill's suggestion, I followed this and came up with this in the Activity onCreate function:

EditText pw = (EditText)findViewById(R.id.editText_Password);
EditText un = (EditText)findViewById(R.id.editText_Username);
pw.setPadding(20,0,20,0);
un.setPadding(20,0,20,0);

And it works great, so thank you very much!

Community
  • 1
  • 1
Kenstar
  • 25
  • 4

2 Answers2

0
android:padding

If you use API 21 - it is a bug.

Look this, may be it can help

Community
  • 1
  • 1
Kirill Shalnov
  • 2,216
  • 1
  • 19
  • 21
0

Use android:paddingStart instead, it replaces this anyway and fixes this bug.

r3flss ExlUtr
  • 720
  • 7
  • 17