8种机械键盘轴体对比
本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?
今天整理过去的笔记时,发现之前我记录了一个关于android typeface字体设置的辟谣笔记
这里分享出来//将字体文件保存在assets/fonts/目录下,创建Typeface对象
Typeface typeFace =Typeface.createFromAsset(getAssets(),”fonts/HandmadeTypewriter.ttf”);
//使用字体
textView.setTypeface(typeFace);
经过测试发现,fonts目录并不是关键字,直接放在asset根目录里面也是一样可以的1Typefacecustom_font=Typeface.createFromAsset(getAssets(),"enter_the_grid.ttf");
这样就足够了
PS 喜报 Oreo开始终于支持将字体文件作为资源放置在res目录下Android 8.0 (API level 26) introduces a new feature, Fonts in XML, which lets you use fonts as resources.
彩蛋:当EditText的InputType属于password大类时,无法给EditText设置字体
password的变体包括:textPassword
numberPassword
textVisiblePassword
textWebPassword
以上4种变体,除了textVisiblePassword之外,都是无法通过android:fontFamily或者其他方式设置字体的为什么要给被覆盖了的密码输入框设置字体呢?
因为,像android.support.design.widget.TextInputLayout这类的输入框装饰器里,浮动提示或者placeholder型提示是可见的,意味着还是有空间让特定字体去发挥的。