Troubles with activity title language

前端 未结 4 1078
一个人的身影
一个人的身影 2021-02-18 20:26

I have two language in my app. values/strings.xml and values-ru/strings.xml When I programmatically change language, all strings translating, b

4条回答
  •  情深已故
    2021-02-18 20:46

    I have done this in following manner and worked for me.

    setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(resources.getString(R.string.app_name));
        setSupportActionBar(toolbar);
    

    Use this code after changing local configuration.

提交回复
热议问题