【发布时间】:2017-04-06 12:22:53
【问题描述】:
假设我的标题是“Nearby - Friends”,我想将其显示为“Nearby- 朋友”
我怎样才能实现它。
我很累,但我做不到。
这里是我使用的代码,我使用字体
TextView text = (TextView) tab.getCustomView();
String subTitle = text.getText().toString().trim();
text.setTextColor(getResources().getColor(R.color.white));
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf");
text.setTypeface(face);
TextView title = new TextView(getApplicationContext());
title.setText("Nearby - ");
title.setTypeface(face);
if (subTitle.equals("NEAR BY")) {
subTitle = "People";
} else if (subTitle.equals("FRIENDS")) {
subTitle = "Friends";
} else if (subTitle.equals("FAMILY")) {
subTitle = "Family";
}
toolbar.setTitle(title.getText().toString() + subTitle);
【问题讨论】:
-
欢迎来到 SO。提问前请阅读如何使用minimal reproducible example提问
-
但我认为问题与工具栏有关,而不是与 TextView 直接有关。那么它是如何重复的呢?
标签: android android-toolbar android-typeface