Android 多语言切换,切换俄语没有效果。
在公司项目里面需要用到俄语,仿照这个程序写了一下,网址如下:https://github.com/bikeming/MultiLanguage
中英文切换都好用,唯独俄语切换时,log日志显示切换了,但是页面没有效果。有没有遇到该类问题的小伙伴呀,谢谢
可能是字体的问题导致俄语无法正常显示。可以尝试在切换到俄语时,手动设置字体为支持俄语的字体,比如使用"Roboto-Regular.ttf"字体。
具体步骤如下:
在assets/fonts文件夹下添加"Roboto-Regular.ttf"字体文件;
在LanguageUtil类中添加以下代码:
// 切换语言后手动设置字体
if ("ru".equals(language)) {
Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Regular.ttf");
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.fontScale = 1.0f;
configuration.setLocale(locale);
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
context.getApplicationContext().createConfigurationContext(configuration);
}
在changeAppLanguage方法中,将上述代码添加到setLocal方法调用之后。
这样做可以保证切换到俄语时,字体可以正确显示,从而解决俄语无法正常显示的问题。
一 绘制图片
1. ImageView 绘制图片
2. SurfaceView 绘制图片
3. 自定义 View 绘制图片
二、AudioRecord API详解
三、使用 AudioRecord 实现录音,并生成wav
四、用 AudioTrack 播放PCM音频
1.AudioTrack 基本使用
2.AudioTrack 详解
3. AudioTrack 与 MediaPlayer 的对比
五、使用 Camera API 采集视频数据
1.预览 Camera 数据
2.取到 NV21 的数据回调
六、使用 MediaExtractor 和 MediaMuxer API 解析和封装 mp4 文件
1.MediaExtractor API介绍
2.MediaMuxer API介绍
3.使用情境
七. MediaCodec API 详解
1.MediaCodec 介绍
2.MediaCodec API 说明
3.MediaCodec 流控
由于文章篇幅受限,剩余内容过多,文中插图有限,下文只能截图目录展示: