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

The following examples show how to use android.view.View#setTextAlignment() . 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 check out the related API usage on the sidebar.
Example 1
Source File: ViewUtils.java    From DevUtils with 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
Source File: ApiCompatibilityUtils.java    From cronet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @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
Source File: ApiCompatibilityUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @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.
    }
}