android - 如何在更改电话语言时反转我的回收站视图但不改变方向?
问题描述
在这段代码中:-我试图从(从右到左水平转换)反转我的recyclerview,它运行良好但是在更改我的手机语言时它变成了(从左到右)如何解决这个问题?我的意思是总是(从右到左)不管改变语言。
public class QuranSafhaListActivity extends AppCompatActivity {
RecyclerView recyclerView;
QuranSafhaListAdapter quranSafhaListAdapter;
LinearLayoutManager linearLayoutManager;
List<SafhaListItems> safhaListItems;
static int position;
String path;
Bitmap bitmap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quran_safha_list);
getSupportActionBar().hide();
safhaListItems = new ArrayList<>();
recyclerView = (RecyclerView) findViewById(R.id.safhaofmoshafrecyclerview);
linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
linearLayoutManager.setReverseLayout(true);
recyclerView.setLayoutManager(linearLayoutManager);
position = getIntent().getIntExtra("Position", 0);
path = Integer.toString(position);
try {
safhaListItems = readMoshafPages(path);
} catch (IOException e) {
e.printStackTrace();
}
// safhaListItems.add(new SafhaListItems(bitmap));
quranSafhaListAdapter = new QuranSafhaListAdapter(this, safhaListItems);
recyclerView.setAdapter(quranSafhaListAdapter);
SnapHelper snapHelper = new LinearSnapHelper();
snapHelper.attachToRecyclerView(recyclerView);
}
public ArrayList<SafhaListItems> readMoshafPages(String path) throws IOException {
ArrayList<SafhaListItems> bitmaps = new ArrayList<>();
AssetManager assetManager = getAssets();
String[] files = assetManager.list("QuranSora" + "/" + path);
for (int i = 0; i < files.length; i++) {
Bitmap bitmap;
InputStream istr = assetManager.open("QuranSora" + "/" + path + "/" + files[i]);
bitmap = BitmapFactory.decodeStream(istr);
bitmaps.add(new SafhaListItems(bitmap));
}
return bitmaps;
}
}
解决方案
<application
...
android:supportsRtl="false"
...
</application>
添加android:supportsRtl="false"
到 AndroidManifest.xml 的应用程序标签中
推荐阅读
- groovy - 从响应中检索令牌并在 SoapUI 中传递以下请求
- java - 无法提前很长时间安排 TimerTask
- c# - Microsoft 认知服务语音识别结果到 C# 中的字符串
- r - 使用 data.table 过滤和分组
- android - Firebase 云消息传递的定时通知
- java - 如何将字符串转换为 JSONObject?
- javascript - 显示时如何隐藏元素:无不起作用
- javascript - React native - 有没有办法使用来自另一个页面的对象?
- javascript - 渲染 DOM 时冻结 CSS 动画
- oracle - 使用文本导入器导入时数据库中的符号不正确