Custom Button with two TextView

前端 未结 3 1634
攒了一身酷
攒了一身酷 2020-12-11 05:34

I\'m trying to Customize button with two TextView with different typeface within a single button. For that I just extended Button and with have written the following code in

3条回答
  •  生来不讨喜
    2020-12-11 06:21

    You can surround the button with a FrameLayout and then add a textview within the FrameLayout. You can manage the typeface in the activity. If the text doesn't show try using bringToFront()

    layout:

     
            

    Activity:

     countDownView = (TextView) findViewById(R.id.linearTimer);
     Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/digital-7.ttf");
     countDownView.setTypeface(tf);
     countDownView.bringToFront();
    

提交回复
热议问题