1

I am trying to find a library or a simple trick to fix the width of each letter in an EditText so that the dashed lines on the background match exactly the number in the EditText. You can see the photo for the desired effect.

enter image description here

emrah
  • 130
  • 1
  • 6
  • I think you should define a layout for each number which contains a textview for letter and a view for underline. set width and height as you wish. than add it to a horizontal linearlayout for each letter – Hakan Saglam Jan 24 '19 at 15:35
  • @HakanSaglam that's what I will do if I can't find a simpler solution. – emrah Jan 24 '19 at 15:48
  • 1
    https://github.com/ChaosLeong/PinView this will help you – Erselan Khan Feb 05 '19 at 16:20

2 Answers2

1

Using various widget i.e. Edittext in a row with the text style to underline will helps to get these type of design else i don't think there is any hard and fast rule or tricks.

Lazy Mind
  • 124
  • 9
0

There is no simple way of doing this, especially not when aligning to a given background, because many factors such as display size and density can change the relative positioning of the EditText. You could perhaps work around this limitation by drawing the white lines under each digit yourself, using a custom font or underlining and separating the digits with a space. See this question for a more detailed explanation on the limitations and possibile solutions concerning letter spacing.

B. Plüster
  • 514
  • 3
  • 10