2011-06-02 27 views
1

在我的應用程序中,我想在設置首選項中添加字體大小(例如18,20,22),以便用戶選擇20,然後整個應用程序應僅使用該字體大小。如何實現這一目標?如何從設置首選項更改應用程序的字體大小?

+0

這裏http://stackoverflow.com/a/12591991/746347見我的答案 – mixel 2012-09-25 22:31:08

回答

1

你可以在你的形式定義的設置代碼,做這樣的:

private void loadSettings() { 

    //load font from global unit named G 
    G.typeFace = Typeface.createFromAsset(getAssets(), "fonts/BYekan.ttf"); 

    TextView titleText = (TextView) findViewById(R.id.reg_title); 
    TextView regTitleText = (TextView) findViewById(R.id.reg_title); 
    TextView bigText = (TextView) findViewById(R.id.textView_big); 
    TextView button_titlet = (TextView) findViewById(R.id.reg_botton_title); 
    btnReg = (Button) findViewById(R.id.btn_reg); 

    titleText.setTypeface(G.typeFace); 
    bigText.setTypeface(G.typeFace); 
    regTitleText.setTypeface(G.typeFace); 
    button_titlet.setTypeface(G.typeFace); 
    btnReg.setTypeface(G.typeFace); 

    titleText.setTextSize(20); 
    bigText.setTextSize(20); 
    regTitleText.setTextSize(20); 
    button_titlet.setTextSize(20); 
    btnReg.setTextSize(20); 


    //end of fonts 

} 
相關問題