Java Code Examples for android.view.View#setTextAlignment()

The following examples show how to use android.view.View#setTextAlignment() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: DevUtils   File: ViewUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置文本的显示方式
 * @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;
}
 
Example 2
/**
 * @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.
    }
}
 
Example 3
/**
 * @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.
    }
}