Change font of the floating label EditText and TextInputLayout

前端 未结 12 1077
北海茫月
北海茫月 2020-12-03 01:23

Someone tried to change the font of the floating label? I changed the source of EditText but the font of the floating label did not change, I am very grateful to those who h

12条回答
  •  心在旅途
    2020-12-03 01:36

    final Typeface tf = Typeface.createFromAsset(getAssets(), "your_custom_font.ttf");
    final TextInputLayout til = (TextInputLayout) findViewById(R.id.yourTextInputLayout);
    til.getEditText().setTypeface(tf);
    til.setTypeface(tf);
    

提交回复
热议问题