当前位置: 首页>>代码示例>>Java>>正文


Java ApiCompatibilityUtils.setTextDirection方法代码示例

本文整理汇总了Java中org.chromium.base.ApiCompatibilityUtils.setTextDirection方法的典型用法代码示例。如果您正苦于以下问题:Java ApiCompatibilityUtils.setTextDirection方法的具体用法?Java ApiCompatibilityUtils.setTextDirection怎么用?Java ApiCompatibilityUtils.setTextDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.base.ApiCompatibilityUtils的用法示例。


在下文中一共展示了ApiCompatibilityUtils.setTextDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showDescriptionLine

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 * @param isUrl Whether this text is a URL (as opposed to a normal string).
 */
private void showDescriptionLine(Spannable str, boolean isUrl) {
    TextView textLine = mContentsView.mTextLine2;
    if (textLine.getVisibility() != VISIBLE) {
        textLine.setVisibility(VISIBLE);
    }
    textLine.setText(str, BufferType.SPANNABLE);

    // Force left-to-right rendering for URLs. See UrlBar constructor for details.
    if (isUrl) {
        textLine.setTextColor(URL_COLOR);
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
    } else {
        textLine.setTextColor(getStandardFontColor());
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:SuggestionView.java

示例2: fixupTextDirection

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Sets the {@link UrlBar}'s text direction based on focus and contents.
 *
 * Should be called whenever focus or text contents change.
 */
private void fixupTextDirection() {
    // When unfocused, force left-to-right rendering at the paragraph level (which is desired
    // for URLs). Right-to-left runs are still rendered RTL, but will not flip the whole URL
    // around. This is consistent with OmniboxViewViews on desktop. When focused, render text
    // normally (to allow users to make non-URL searches and to avoid showing Android's split
    // insertion point when an RTL user enters RTL text). Also render text normally when the
    // text field is empty (because then it displays an instruction that is not a URL).
    if (mFocused || length() == 0) {
        ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_INHERIT);
    } else {
        ApiCompatibilityUtils.setTextDirection(this, TEXT_DIRECTION_LTR);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:UrlBar.java


注:本文中的org.chromium.base.ApiCompatibilityUtils.setTextDirection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。