我在TextView中添加了Drawable start图像.问题是我无法控制TextView中Drawable的重力
到目前为止我取得了什么
这是我的TextView
<TextView
android:id="@+id/tv_8_digit_check"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawablePadding="@dimen/dimen_4"
android:drawableStart="@drawable/ic_validate"
android:text="@string/at_least_8_characters_txt"
android:textColor="@color/white_trans"
android:textSize="12sp" />
Run Code Online (Sandbox Code Playgroud)
关于如何将Drawable的重力设置为顶部/开始的任何建议?谢谢
android textview android-layout android-drawable android-gravity
自从我在移动设备上升级到android oreo后,我的RTL支持应用程序无效.它正在将字符串更改为阿拉伯语,但不会更改布局方向.但如果我将同一个RTL转移到低于oreo的任何设备,一切正常.其他人遇到过这个问题?关于这个bug和解决方法还有任何官方声明吗?
下面是我更改区域设置的方法
public static boolean setDefaultLocale(Context context) {
Resources resources = context.getResources();
PreferenceManager preferenceManager = PreferenceManager.getInstance();
String localLanguage = resources.getConfiguration().locale.getLanguage();
boolean isLanguageChanged = !preferenceManager.getCurrentLanguageCode().equalsIgnoreCase(localLanguage);
if (isLanguageChanged) {
Log.d("", preferenceManager.getCurrentLanguageCode());
Locale locale = new Locale(preferenceManager.getCurrentLanguageCode());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
Locale.setDefault(Locale.Category.DISPLAY, locale);
else
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
resources.updateConfiguration(config, resources.getDisplayMetrics());
((Activity) context).recreate();
}
return isLanguageChanged;
}
Run Code Online (Sandbox Code Playgroud) 我现在面临的一个问题是,当我定义EditText
为password
类型,并查看我的屏幕在阿拉伯语密码字段提示文本显示在左侧,而不是右侧[即预期.
以上是我得到的结果.我需要密码提示文本从右侧开始,这是阿拉伯语着作开始的地方.我也试过添加文字引力但没有运气.