change font for editText hint

2019-01-11 22:56发布

Is it possible to change the font for the hint displayed in the EditText field? I want to set the font in the xml itself.

8条回答
Fickle 薄情
2楼-- · 2019-01-11 23:32

use this code:

edittext.setAccentTypeface(typeface);
查看更多
我只想做你的唯一
3楼-- · 2019-01-11 23:35

There is a very simple way to do it. I just did in my App and it worked. The Key is set Facetype of your TextInputLayout too along with EditText.

mEmailView.setTypeface(Typeface.createFromAsset(getAssets(), getString(R.string.app_font)));
((TextInputLayout) findViewById(R.id.tilEmail)).setTypeface(Typeface.createFromAsset(getAssets(), getString(R.string.app_font)));
查看更多
登录 后发表回答