Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.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 字体不变_Android_Xml_Text_Button_Fonts - Fatal编程技术网

Android 字体不变

Android 字体不变,android,xml,text,button,fonts,Android,Xml,Text,Button,Fonts,我有一个问题..我使用了不同的字体,只有一个按钮实际显示了该字体的文本。。。 只有“继续”按钮实际显示正确的字体!! 我会给出代码,因为我试图修复它,但失败了……也许你可以修复它: Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/TYPOGRAPH PRO Ultra Light.ttf"); TextView tv = (TextView) findViewById(R.i

我有一个问题..我使用了不同的字体,只有一个按钮实际显示了该字体的文本。。。 只有“继续”按钮实际显示正确的字体!! 我会给出代码,因为我试图修复它,但失败了……也许你可以修复它:

 Typeface tf = Typeface.createFromAsset(getAssets(),
                "fonts/TYPOGRAPH PRO Ultra Light.ttf");

        TextView tv = (TextView) findViewById(R.id.continuebutton);
        tv.setTypeface(tf);


        TextView tv2 = (TextView) findViewById(R.id.newgame);
        tv.setTypeface(tf);

        TextView tv3 = (TextView) findViewById(R.id.aboutbutton);
        tv.setTypeface(tf);

        TextView tv4 = (TextView) findViewById(R.id.exit);
        tv.setTypeface(tf);
关于xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="30dip" android:background="@drawable/pickip">


    <LinearLayout
    android:orientation="vertical"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_gravity="center">



<Button

     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="Continue"
     android:id="@+id/continuebutton"
     android:background="@android:color/transparent"
     android:textColor="@android:color/white"
     android:textSize="32dp"
      />
<Button
android:id="@+id/newgame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Game"
android:background="@android:color/transparent"
android:textColor="@android:color/white"
android:textSize="32dp"
/>
<Button
android:id="@+id/aboutbutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="About"
android:background="@android:color/transparent"
android:textColor="@android:color/white"
android:textSize="32dp"
/>
<Button
android:id="@+id/exit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Exit"
android:background="@android:color/transparent"
android:textColor="@android:color/white"
android:textSize="32dp"
/>

     </LinearLayout>
</LinearLayout>

您使用的是
tv.setTypface
始终。。。您必须将其更改为
tv2
tv3

    TextView tv = (TextView) findViewById(R.id.continuebutton);
    tv.setTypeface(tf);


    TextView tv2 = (TextView) findViewById(R.id.newgame);
    tv2.setTypeface(tf);

    TextView tv3 = (TextView) findViewById(R.id.aboutbutton);
    tv3.setTypeface(tf);

    TextView tv4 = (TextView) findViewById(R.id.exit);
    tv4.setTypeface(tf);

您正在使用
tv.setTypface
始终。。。您必须将其更改为
tv2
tv3

    TextView tv = (TextView) findViewById(R.id.continuebutton);
    tv.setTypeface(tf);


    TextView tv2 = (TextView) findViewById(R.id.newgame);
    tv2.setTypeface(tf);

    TextView tv3 = (TextView) findViewById(R.id.aboutbutton);
    tv3.setTypeface(tf);

    TextView tv4 = (TextView) findViewById(R.id.exit);
    tv4.setTypeface(tf);

哈哈,我真不敢相信…我的朋友是7小时编码的结果…:)我不相信…我的朋友是7小时编码的结果…:)我不相信这个愚蠢的问题