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

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

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

TextView.setLayerType介绍

暂无

代码示例

代码示例来源:origin: burhanrashid52/PhotoEditor

txtTextEmoji.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

代码示例来源:origin: andforce/iBeebo

private void configLayerType(ViewHolder holder) {
  boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
  if (!disableHardAccelerated)
    return;
  int currentWidgetLayerType = holder.content.getLayerType();
  if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
    holder.content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    if (holder.time != null)
      holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  }
}

代码示例来源:origin: andforce/iBeebo

private void configLayerType(ViewHolder holder) {
  boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
  if (!disableHardAccelerated) {
    return;
  }
  int currentWidgetLayerType = holder.username.getLayerType();
  if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
    holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    if (holder.content != null) {
      holder.content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
  }
}

代码示例来源:origin: andforce/iBeebo

private void configLayerType(ViewHolder holder) {
  boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
  if (!disableHardAccelerated) {
    return;
  }
  int currentWidgetLayerType = holder.username.getLayerType();
  if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
    holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    if (holder.weiboTextContent != null) {
      holder.weiboTextContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    if (holder.repost_content != null) {
      holder.repost_content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    if (holder.time != null) {
      holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    if (holder.repost_count != null) {
      holder.repost_count.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    if (holder.comment_count != null) {
      holder.comment_count.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
  }
}

代码示例来源:origin: andforce/iBeebo

private void configLayerType(ViewHolder holder) {
  boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
  if (!disableHardAccelerated) {
    return;
  }
  int currentWidgetLayerType = holder.username.getLayerType();
  if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
    holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    if (holder.weiboTextContent != null) {
      holder.weiboTextContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    if (holder.time != null) {
      holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
  }
}

代码示例来源:origin: eventtus/photo-editor-android

public void addEmoji(String emojiName, Typeface emojiFont) {
  LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View emojiRootView = inflater.inflate(R.layout.photo_editor_sdk_text_item_list, null);
  TextView emojiTextView = (TextView) emojiRootView.findViewById(R.id.photo_editor_sdk_text_tv);
  emojiTextView.setTypeface(emojiFont);
  emojiTextView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  emojiTextView.setText(convertEmoji(emojiName));
  MultiTouchListener multiTouchListener = new MultiTouchListener(deleteView,
      parentView, this.imageView, onPhotoEditorSDKListener);
  multiTouchListener.setOnMultiTouchListener(this);
  emojiRootView.setOnTouchListener(multiTouchListener);
  RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
      ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
  parentView.addView(emojiRootView, params);
  addedViews.add(emojiRootView);
  if (onPhotoEditorSDKListener != null)
    onPhotoEditorSDKListener.onAddViewListener(ViewType.EMOJI, addedViews.size());
}

代码示例来源:origin: PeterStaev/nativescript-photo-editor

public void addEmoji(String emojiName, Typeface emojiFont) {
  LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View emojiRootView = inflater.inflate(R.layout.photo_editor_sdk_text_item_list, null);
  TextView emojiTextView = (TextView) emojiRootView.findViewById(R.id.photo_editor_sdk_text_tv);
  emojiTextView.setTypeface(emojiFont);
  emojiTextView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  emojiTextView.setText(convertEmoji(emojiName));
  MultiTouchListener multiTouchListener = new MultiTouchListener(deleteView,
      parentView, this.imageView, onPhotoEditorSDKListener);
  multiTouchListener.setOnMultiTouchListener(this);
  emojiRootView.setOnTouchListener(multiTouchListener);
  RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
      ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
  parentView.addView(emojiRootView, params);
  addedViews.add(emojiRootView);
  if (onPhotoEditorSDKListener != null)
    onPhotoEditorSDKListener.onAddViewListener(ViewType.EMOJI, addedViews.size());
}

代码示例来源:origin: windrunnerlihuan/DogCamera

private void initViews() {
  setOrientation(LinearLayout.VERTICAL);
  setGravity(Gravity.CENTER);
  mIdView = new TextView(getContext());
  mIdView.setLayerType(LAYER_TYPE_SOFTWARE, null);
  mIdView.setTextColor(Color.WHITE);
  mIdView.setTypeface(null, Typeface.BOLD);
  mIdView.setTextSize(36);
  mIdView.setGravity(Gravity.LEFT);
  mIdView.setShadowLayer(ViewUtils.dip2px(getContext(), 2), ViewUtils.dip2px(getContext(), 1),
      ViewUtils.dip2px(getContext(), 1), Color.parseColor("#80000000"));
  addView(mIdView);
  mNameView = new TextView(getContext());
  mNameView.setLayerType(LAYER_TYPE_SOFTWARE, null);
  mNameView.setTextColor(Color.WHITE);
  mNameView.setTypeface(null, Typeface.BOLD);
  mNameView.setTextSize(17);
  mNameView.setGravity(Gravity.LEFT);
  mNameView.setShadowLayer(ViewUtils.dip2px(getContext(), 2), ViewUtils.dip2px(getContext(), 1),
      ViewUtils.dip2px(getContext(), 1), Color.parseColor("#80000000"));
  addView(mNameView);
}

代码示例来源:origin: lime-ime/limeime

mPreviewText = (TextView) inflate.inflate(previewLayout, null);
if(mtHardwareAcceleratedDrawingEnabled)
  mPreviewText.setLayerType(View.LAYER_TYPE_HARDWARE,null);
mKeyPreviewFadeInAnimator = AnimationUtils.loadAnimation(mContext,R.anim.key_preview_fadein);
mKeyPreviewFadeOutAnimator = AnimationUtils.loadAnimation(mContext,R.anim.key_preview_fadeout);

代码示例来源:origin: AriesHoo/UIWidget

public TitleBarView setTitleMainTextMarquee(boolean enable) {
  this.mTitleMainTextMarquee = enable;
  if (enable) {
    setTitleSubTextMarquee(false);
    mTvTitleMain.setSingleLine();
    mTvTitleMain.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    mTvTitleMain.setFocusable(true);
    mTvTitleMain.setFocusableInTouchMode(true);
    mTvTitleMain.requestFocus();
    mTvTitleMain.setOnFocusChangeListener(new View.OnFocusChangeListener() {
      @Override
      public void onFocusChange(View v, boolean hasFocus) {
        if (!hasFocus && mTitleMainTextMarquee) {
          mTvTitleMain.requestFocus();
        }
      }
    });
    //开启硬件加速
    mTvTitleMain.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  } else {
    mTvTitleMain.setMaxLines(1);
    mTvTitleMain.setEllipsize(TextUtils.TruncateAt.END);
    mTvTitleMain.setOnFocusChangeListener(null);
    //关闭硬件加速
    mTvTitleMain.setLayerType(View.LAYER_TYPE_NONE, null);
  }
  return this;
}

代码示例来源:origin: AriesHoo/UIWidget

mTvTitleSub.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
  mTvTitleSub.setMaxLines(1);
  mTvTitleSub.setOnFocusChangeListener(null);
  mTvTitleSub.setLayerType(View.LAYER_TYPE_NONE, null);

相关文章

TextView类方法