如何在android应用程序中使用Roboto

如何在android应用程序中使用Roboto,android,fonts,android-launcher,android-typeface,Android,Fonts,Android Launcher,Android Typeface,我一直在研究如何在我的android应用程序中使用Roboto。我偶然发现了一个似乎很有前途的git项目,专门用于我需要的东西。但是当我下载这个项目时,它拒绝工作。我试着解决一些问题 属性>android>android 4.4.2 从minSdkVersion3更改为11:android:minSdkVersion=“11” 我还没有完全康复 error: No resource identifier found for attribute 'typeface' in package

我一直在研究如何在我的android应用程序中使用Roboto。我偶然发现了一个似乎很有前途的git项目,专门用于我需要的东西。但是当我下载这个项目时,它拒绝工作。我试着解决一些问题

  • 属性>android>android 4.4.2
  • minSdkVersion
    3更改为11:
    android:minSdkVersion=“11”
我还没有完全康复

error: No resource identifier found for attribute 'typeface' in package 
 'com.devspark.robototextview.sample'
在单个布局文件中:
activity\u main.xml

该项目正在进行中

有人知道我该如何使用它吗?或者有人建议我如何使用Roboto,使其具有同等的简单性

更新

我在MacOSX小牛上使用eclipse。我刚刚检查并看到src文件夹是空的,MainActivity.java文件实际上位于文件夹路径下,文件夹包括:
java>com>devspark>robototextview>sample
。所以我的第一个猜测是eclipse不知道如何导入项目。如果真的是问题的话,有人知道我该怎么解决吗。顺便说一句,我所有的项目都在git上,我使用git的示例和库已经有一段时间了。因此,问题很可能是这个特定的项目。

示例布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">

    <TextView
            android:id="@+id/custom_font"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="This is the roboto font."/>

</LinearLayout>

你能发布一些你正在试用的代码吗?@yelliung我不知道你的意思。我提到的git就是示例。链接再次被删除。否则我不确定问题的目的。是的,我希望避免在源代码中调用字体。你知道用xml做这件事的简单方法吗?你可以,但你需要创建一个自定义类来扩展textView并覆盖你设置样式的方法。如果你没有太多的文本视图,这个方法会更简单。检查这个答案:另外,阅读评论以获得更好的解释。
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/roboto.ttf");
txt.setTypeface(font);