0

In my resource xml file, I am trying to have a button that looks like the "Resend Code" in the image below. My strategy has been to use a button and give it the same background as the background color of the screen and add a bottom border only. How should I add the bottom border ? PS: The button in question is the "Resend Code" below the "Cancel". enter image description here

codigomonstruo
  • 1,081
  • 1
  • 11
  • 45

2 Answers2

2

you can use Textview and underline to get the same look like your design

Either you can use

mTextView.setPaintFlags(mTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
mTextView.setText("Resend Code");

Or you can use

String htmlString="<u>Resend Code</u>";
mTextView.setText(Html.fromHtml(htmlString));

For button, you should make a string resource as

<string name="underlined_dynamic_text"><u>%s</u></string>

and use this as a

button.setText(getString(R.string.underlined_dynamic_text, "Resend Code");
sudesh regmi
  • 536
  • 4
  • 12
0

You can set the background(the image resource) of the button to only be the border.

But if I were to reproduce that "Resend Code". I would just use a TextView with an underline.

Israel dela Cruz
  • 794
  • 1
  • 5
  • 11