下面列出了android.view.View#setTextAlignment ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 设置文本的显示方式
* @param view {@link View}
* @param textAlignment 文本的显示方式
* @return {@link View}
*/
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public static View setTextAlignment(final View view, final int textAlignment) {
if (view != null) {
view.setTextAlignment(textAlignment);
}
return view;
}
/**
* @see android.view.View#setTextAlignment(int)
*/
public static void setTextAlignment(View view, int textAlignment) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setTextAlignment(textAlignment);
} else {
// Do nothing. RTL text isn't supported before JB MR1.
}
}
/**
* @see android.view.View#setTextAlignment(int)
*/
public static void setTextAlignment(View view, int textAlignment) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setTextAlignment(textAlignment);
} else {
// Do nothing. RTL text isn't supported before JB MR1.
}
}