How to Underline Text of Button in Android?

前端 未结 5 920
鱼传尺愫
鱼传尺愫 2020-12-23 20:58

I have a button which is transparent and has an icon and text.

I want to underline the text of the button but i have not been able to do this.

Below is my

5条回答
  •  执笔经年
    2020-12-23 21:04

    You can't set underline from xml file. To set underline using code you need to set the underline flag on button.

    Button button = (Button) findViewById(R.id.park);
    button.setPaintFlags(button.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    

提交回复
热议问题