强制区域设置不会影响工具栏的内容
问题描述:
我正在使用下面的代码更改区域设置。这已经是一天试图改变我的场所,但还没有成功。强制区域设置不会影响工具栏的内容
Locale locale;
public void changeLanguage(Locale localeChanger){
locale=localeChanger;
Resources res = getResources();
DisplayMetrics displayMetrics = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = locale;
res.updateConfiguration(conf, displayMetrics);
Intent refreshStartPage = new Intent(this, StartPage.class);
startActivity(refreshStartPage);
recreate();
}
,在这里我的工具栏的XML代码
<android.support.v7.widget.Toolbar
android:id="@+id/page_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="title"
android:id="@+id/my_toolbar_title" />
</android.support.v7.widget.Toolbar>
答
摆脱文本行的工具栏布局
android:text="title"
内再加入
setTitle (R.string.name_here)
工具栏初值法里面。希望,你有你想要的。