0
我有一個問題..我使用不同的字體,只有1個按鈕實際上顯示該字體的文本... 只有繼續按鈕實際上顯示正確的字體! 我給的代碼,因爲我試圖修復它,但我失敗了......也許你可以解決它:字體不變
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>
笑我不能相信這...這我的朋友是編碼7小時......結果:) SR對於愚蠢的問題 – user1015311