Android – how do I use locale and configuration to select different asset files as my language changes?
•
Android
I want to change the JSON file from the assets folder according to the language changes in the application, and I want to feel the data in recyclerview
But my adapter is not suitable for this change
resolvent:
Make sure that you must set the adapter again after selecting another locale file. If you are using recyclerview, set layoutmanager as your Recycle Bin view, as shown below:
RecyclerView yourRecyclerView= (RecyclerView) findViewById(R.id.yourRecyclerView);
linearlayoutmanager layoutManager = new linearlayoutmanager(MainActivity.this, linearlayoutmanager.VERTICAL, false);
rc_qList.setHasFixedSize(true);
rc_qList.setLayoutManager(layoutManager);
RecyclerViewAdapter yourAdapter = new RecyclerViewAdapter (MainActivity.this, yourArrayList);
rc_qList.setAdapter(yourAdapter);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码