2013-06-21 2 views
0

내 클래스 onCreate() 함수에서 initFonts() 함수를 통해 텍스트 스타일을 변경할 수 없습니다. 오류는 없지만 아무 일도 일어나지 않습니다. 무한 루프 (1 초 지연) 인 실행 파일을 실행 중입니다. 이게 문제 야?oncreate에서 TextView 스타일을 변경할 수 없습니다.

protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.activity_main); 

     initFonts(); 

     // Start a load dialog 
     progressdialog = new ProgressDialog(MainActivity.this); 
     progressdialog.setTitle("Please wait"); 
     progressdialog.setMessage("Loading..."); 
     progressdialog.setCancelable(false); 
     progressdialog.show(); 


     // Start updating all lists 
     runnable = new Runnable() { 
      public void run() { 
       updateList(); 
      } 
     }; 

     // Keep it running 
     runnable.run();   
    } 

나는 initFonts() 방법의 글꼴을 변경하고 있습니다 :

TextView cur = (TextView)findViewById(R.id.current); 
TextView plus = (TextView)findViewById(R.id.plus); 
TextView min = (TextView)findViewById(R.id.min); 

cur.setTextSize(150); 
Typeface font = Typeface.createFromAsset(getAssets(), "font.ttf"); 
cur.setTypeface(font); 

plus.getBackground().setAlpha(45); 
min.getBackground().setAlpha(45); 
+0

는 어떤 폴더에 있습니다 .. 당신의 font.ttf 파일을 확인하십시오.? – Riser

+0

예 폴더에 – user6827

+0

내 대답을 참조하십시오. – Riser

답변

0
Typeface font = Typeface.createFromAsset(getAssets(), "foldername/font.ttf"); 
cur.setTypeface(font); 
+0

아니요,이 기능이 작동하지 않습니다. 자산 루트 폴더 – user6827

+0

에 수정 된 코드가 저장되어 있습니다. – Riser

+0

텍스트 뷰가 작동하지 않습니다. 심지어 청취자를 설정할 수 없다. – user6827

관련 문제