2011-11-02 5 views
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에 : 당신은 tv.setTypface를 사용하는

<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> 

답변

3

을 항상 ... 당신은 등, 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); 
+0

권자 믿을 수 없어 ... 내 친구가 ... 7 시간 동안 코딩의 결과입니다 :) SR 바보 같은 질문에 대한 ry – user1015311

관련 문제