本文整理汇总了Java中android.text.Layout.DIR_LEFT_TO_RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java Layout.DIR_LEFT_TO_RIGHT属性的具体用法?Java Layout.DIR_LEFT_TO_RIGHT怎么用?Java Layout.DIR_LEFT_TO_RIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.Layout
的用法示例。
在下文中一共展示了Layout.DIR_LEFT_TO_RIGHT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUrlDirection
/**
* If the direction of the URL has changed, update mUrlDirection and notify the
* UrlDirectionListeners.
*/
private void updateUrlDirection() {
Layout layout = getLayout();
if (layout == null) return;
int urlDirection;
if (length() == 0) {
urlDirection = LAYOUT_DIRECTION_LOCALE;
} else if (layout.getParagraphDirection(0) == Layout.DIR_LEFT_TO_RIGHT) {
urlDirection = LAYOUT_DIRECTION_LTR;
} else {
urlDirection = LAYOUT_DIRECTION_RTL;
}
if (urlDirection != mUrlDirection) {
mUrlDirection = urlDirection;
if (mUrlDirectionListener != null) {
mUrlDirectionListener.onUrlDirectionChanged(urlDirection);
}
}
}
示例2: getTextDirection
private static String getTextDirection(Spanned text, int start, int end) {
// FIXME not supported
int paraDir = Layout.DIR_LEFT_TO_RIGHT;
// final int len = end - start;
// final byte[] levels = ArrayUtils.newUnpaddedByteArray(len);
// final char[] buffer = TextUtils.obtain(len);
// TextUtils.getChars(text, start, end, buffer, 0);
// int paraDir = AndroidBidi.bidi(Layout.DIR_REQUEST_DEFAULT_LTR, buffer, levels, len,
// false /* no info */);
switch (paraDir) {
case Layout.DIR_RIGHT_TO_LEFT:
return " dir=\"rtl\"";
case Layout.DIR_LEFT_TO_RIGHT:
default:
return " dir=\"ltr\"";
}
}