我是个菜鸟。我在这里看到了一些解决方案,而这只是在我头上跳出来的。有人能帮我在按钮上设置字体吗?此外,如果我可以使它斜体,粗体等。这是我的XML代码
<Button
android:id="@+id/button1"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignBottom="@+id/tableLayout1"
android:layout_alignRight="@+id/relativeLayout1"
android:background="@drawable/crea"
android:textSize="30sp"
android:textColor="#ff0000"/>发布于 2013-11-05 11:07:16
你不能在没有购买许可证的情况下使用漫画sans MS:
https://learn.microsoft.com/en-us/typography/font-redistribution-licensing
还有免费的类似字体:
https://fontlibrary.org/en/font/comic-relief
使用不同字体的基本操作是将字体文件添加到项目中的assets文件夹中,然后在小部件上使用setTypeface:
Typeface font = Typeface.createFromAsset(getAssets(), "ComicRelief.ttf");
Button bt=(Button) findViewById(R.id.button0);
bt.setTypeface(font);有关使用字体的详细信息如下:
https://tekeye.uk/android/examples/android-textview-edittext-font
https://stackoverflow.com/questions/19786732
复制相似问题