我想为我的android应用程序使用自定义字体,但我有一个问题。
我需要显示自定义字体,但应用程序显示两个文本,一个具有默认字体系列,另一个具有自定义字体系列。。。它似乎复制了我的文本视图
我遵循了本教程:
http://blog.goyello.com/2014/08/01/how-to-use-custom-fonts-in-android-apps-and-not-get-fat-3/
然而,我也尝试在我的活动的onCreate函数中使用以下代码:
TextView txt = (TextView) findViewById(R.id.bloodmatesIntro1);
Typeface font = Typeface.createFromAsset(getAssets(), "BaroqueScript.ttf");
txt.setTypeface(font);
以及xml文件上的代码
<TextView
android:id="@+id/bloodmatesIntro1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/bloodmates_intro_1"/>
怎么了?
编辑:
我发现下一个代码(由facebook提供)产生了我的问题
https://developers.facebook.com/docs/android/login-with-facebook#step1
:
if (savedInstanceState == null) {
// Add the fragment on initial activity setup
mainFragment = new MainFragment();
getSupportFragmentManager()
.beginTransaction()
.add(android.R.id.content, mainFragment)
.commit();
} else {
// Or set the fragment from restored state info
mainFragment = (MainFragment) getSupportFragmentManager()
.findFragmentById(android.R.id.content);
}
如何在同一活动中使用自定义字体并登录facebook?