Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android上使用xml格式的自定义字体_Android_Xml_Fonts - Fatal编程技术网

在android上使用xml格式的自定义字体

在android上使用xml格式的自定义字体,android,xml,fonts,Android,Xml,Fonts,我将学习本教程: 以编程方式将自定义日文字体应用到我的android应用程序。如何在xml上而不是通过编程实现这一点?因为我想在elipse图形布局上预览字体 此外,当我以编程方式执行此操作时,我的文本不会集中在imageview上。我这样做是为了使它居中,如果我不更改字体,它就会工作: ` ` 在您希望使用该字体的每个文本视图上使用android:fontFamily标记。很抱歉,但我很确定,仅使用XML代码是无法做到这一点的。您只能通过xml应用内置字体 这是另一个与你类似的问题:

我将学习本教程:

以编程方式将自定义日文字体应用到我的android应用程序。如何在xml上而不是通过编程实现这一点?因为我想在elipse图形布局上预览字体

此外,当我以编程方式执行此操作时,我的文本不会集中在imageview上。我这样做是为了使它居中,如果我不更改字体,它就会工作:

`


`

在您希望使用该字体的每个文本视图上使用android:fontFamily标记。

很抱歉,但我很确定,仅使用XML代码是无法做到这一点的。您只能通过xml应用内置字体

这是另一个与你类似的问题:

        <ImageView
            android:id="@+id/karuta1_imageview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:src="@drawable/karutavaziatreinamento" />

        <TextView
            android:id="@+id/texto_karuta1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="@string/texto_karuta1"
            android:textStyle="bold"
            android:textSize="29sp"
              />
    </RelativeLayout>`