正如标题所示,字体文件似乎无法找到。 我引用错误:
未处理的例外:
Java.Lang.RuntimeException:找不到字体资源 fontawesome-webfont.ttf“
代码是:
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
AssetManager assets = this.Assets;
Typeface font = Typeface.CreateFromAsset(assets, "fontawesome-webfont.ttf");
// Set our view from the "main" layout resource
Button button = (Button)FindViewById(Resource.Id.btnIniciarSesion);
button.SetTypeface(font, TypefaceStyle.Normal);
// Get our button from the layout resource,
// and attach an event to it
}
}
字体文件位于assets文件夹中,如下图所示:
我可以尝试什么?
答案 0 :(得分:1)
试试这个,
Typeface font = Typeface.createFromAsset(getContext().getAssets(), "fontawesome-webfont.ttf");
答案 1 :(得分:0)
我删除并再次创建解决方案,问题“神奇地”消失了。
答案 2 :(得分:0)
你应该在“fontawesome-webfont.ttf”文件属性中设置 - >构建Action并选择AndroidAsset
答案 3 :(得分:0)
尝试这条适合我的指示
HsqlSocketFactory.getInstance(false).setSocketConfigurator(this);
HsqlSocketFactory.getInstance.setSocketConfigurator(this);
LogRepository.DATABASE.info("Configured connection on HsqlSocketFactory");