android.widget.TextView.setTextDirection()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(517)

本文整理了Java中android.widget.TextView.setTextDirection()方法的一些代码示例,展示了TextView.setTextDirection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setTextDirection()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setTextDirection

TextView.setTextDirection介绍

暂无

代码示例

代码示例来源:origin: qiujuer/Genius-Android

static void setTextDirection(TextView number, int textDirection) {
    number.setTextDirection(textDirection);
  }
}

代码示例来源:origin: rockon999/LeanbackLauncher

private TextView createTextView(float textSize, int textColor) {
  TextView textView = new TextView(getContext());
  textView.setTypeface(this.mTypeface);
  textView.setTextSize(0, textSize);
  textView.setTextColor(textColor);
  textView.setEllipsize(TruncateAt.END);
  textView.setTextDirection(5);
  return textView;
}

代码示例来源:origin: stackoverflow.com

textViewFileName.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
textViewFileName.setTextDirection(View.TEXT_DIRECTION_LTR);
textViewFileInfo.setTextDirection(View.TEXT_DIRECTION_LOCALE);

代码示例来源:origin: jaredrummler/MaterialSpinner

Configuration config = context.getResources().getConfiguration();
if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
 textView.setTextDirection(View.TEXT_DIRECTION_RTL);

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Sets phone number for a list item. This takes care of number highlighting if the highlight
 * mask exists.
 */
public void setPhoneNumber(String text, String countryIso) {
  if (text == null) {
    if (mDataView != null) {
      mDataView.setVisibility(View.GONE);
    }
  } else {
    getDataView();
    // TODO: Format number using PhoneNumberUtils.formatNumber before assigning it to
    // mDataView. Make sure that determination of the highlight sequences are done only
    // after number formatting.
    // Sets phone number texts for display after highlighting it, if applicable.
    // CharSequence textToSet = text;
    final SpannableString textToSet = new SpannableString(text);
    if (mNumberHighlightSequence.size() != 0) {
      final HighlightSequence highlightSequence = mNumberHighlightSequence.get(0);
      mTextHighlighter.applyMaskingHighlight(textToSet, highlightSequence.start,
          highlightSequence.end);
    }
    setMarqueeText(mDataView, textToSet);
    mDataView.setVisibility(VISIBLE);
    // We have a phone number as "mDataView" so make it always LTR and VIEW_START
    mDataView.setTextDirection(View.TEXT_DIRECTION_LTR);
    mDataView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

nameText = displayNumber;
  views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR);
} else {
  nameText = details.getPreferredName();

代码示例来源:origin: geniusgithub/AndroidDialer

public void setDisplayName(CharSequence name) {
  if (!TextUtils.isEmpty(name)) {
    // Chooses the available highlighting method for highlighting.
    if (mHighlightedPrefix != null) {
      name = mTextHighlighter.applyPrefixHighlight(name, mHighlightedPrefix);
    } else if (mNameHighlightSequence.size() != 0) {
      final SpannableString spannableName = new SpannableString(name);
      for (HighlightSequence highlightSequence : mNameHighlightSequence) {
        mTextHighlighter.applyMaskingHighlight(spannableName, highlightSequence.start,
            highlightSequence.end);
      }
      name = spannableName;
    }
  } else {
    name = mUnknownNameText;
  }
  setMarqueeText(getNameTextView(), name);
  if (ContactDisplayUtils.isPossiblePhoneNumber(name)) {
    // Give the text-to-speech engine a hint that it's a phone number
    mNameTextView.setTextDirection(View.TEXT_DIRECTION_LTR);
    mNameTextView.setContentDescription(
        PhoneNumberUtilsCompat.createTtsSpannable(name.toString()));
  } else {
    // Remove span tags of highlighting for talkback to avoid reading highlighting and rest
    // of the name into two separate parts.
    mNameTextView.setContentDescription(name.toString());
  }
}

相关文章

TextView类方法