Özel yazı tipi ayarlamaya çalışıyorum ancak her zaman textview
'un boş olduğu hatayı alıyorum.Özel yazı tipi çubuğu ile eylem çubuğu başlığı ayarlanamıyor
int titleId = getResources().getIdentifier("action_bar_title", "id", "android");
TextView yourTextView = (TextView) findViewById(titleId);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/barrett_normal.ttf");
alınıyor aşağıdaki hata:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowCustomEnabled(true);
int titleId = getResources().getIdentifier("action_bar_title", "id", "android");
tv = (TextView) findViewById(titleId);
tf = Typeface.createFromAsset(getAssets(), "fonts/barrett_normal.ttf");
tv.setTypeface(tf);
} catch (Exception e) {
e.printStackTrace();
}
setActionBarTitle(this.getTitle());
}
sizin OnCreate kod ve xml –
burada bir göz atın gösterir: http://stackoverflow.com/questions/8607707/how-to-set-a-custom-font-in-the-actionbar-title –
@Aditya 'OnCreate()' yönteminde çok fazla kod yazdım –