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".
Asked
Active
Viewed 127 times
0

codigomonstruo
- 1,081
- 1
- 11
- 45
-
1Please share your xml code – FedeFonto May 15 '19 at 23:03
-
Possible duplicate of [Can I underline text in an Android layout?](https://stackoverflow.com/questions/2394935/can-i-underline-text-in-an-android-layout) – Saurabh Bhandari May 16 '19 at 04:38
2 Answers
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