/** * 设置左边的drawable * * @param tv * @param drawable */ public static void setLeftDrawable(TextView tv, Drawable drawable) { tv.setCompoundDrawables(drawable, null, null, null); }
public void reset() { if (!mIsLocal) { mRankTextView.setText(R.string.loading_text); mScoreTextView.setText(R.string.loading_text); mScoreTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); mBookmarked.setVisibility(INVISIBLE); } mTitleTextView.setText(getContext().getString(R.string.loading_text)); mPostedTextView.setText(R.string.loading_text); mSourceTextView.setText(R.string.loading_text); mSourceTextView.setCompoundDrawables(null, null, null, null); mCommentButton.setVisibility(View.INVISIBLE); }
public void hideErrorIcon() { mTvEmptyMessage.setCompoundDrawables(null, null, null, null); }
private void setActionDrawable(TextView text, Drawable drawable) { drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); text.setCompoundDrawables(null, drawable, null, null); }
/** * 左图标 * * @param id */ public void setLeftImagSrc(int id) { ivBack.setCompoundDrawables(getResources().getDrawable(id),null,null,null); } /**
@Override public void convert(EasyLVHolder holder, int position, BookMixAToc.mixToc.Chapters chapters) { TextView tvTocItem = holder.getView(R.id.tvTocItem); tvTocItem.setText(chapters.title); Drawable drawable; if (currentChapter == position + 1) { tvTocItem.setTextColor(ContextCompat.getColor(mContext, R.color.light_red)); drawable = ContextCompat.getDrawable(mContext, R.drawable.ic_toc_item_activated); } else if (isEpub || FileUtils.getChapterFile(bookId, position + 1).length() > 10) { tvTocItem.setTextColor(ContextCompat.getColor(mContext, R.color.light_black)); drawable = ContextCompat.getDrawable(mContext, R.drawable.ic_toc_item_download); } else { tvTocItem.setTextColor(ContextCompat.getColor(mContext, R.color.light_black)); drawable = ContextCompat.getDrawable(mContext, R.drawable.ic_toc_item_normal); } drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); tvTocItem.setCompoundDrawables(drawable, null, null, null); }
/** * 设置右边view的drawableBottom * * @param drawableBottom 资源 * @return 返回 */ public CommonTextView setRightDrawableBottom(Drawable drawableBottom) { if (drawableBottom != null) { drawableBottom.setBounds(0, 0, drawableBottom.getMinimumWidth(), drawableBottom.getMinimumHeight()); } if (rightTextView == null) { initRightText(); } rightTextView.setCompoundDrawables(null, null, null, drawableBottom); return this; }
/** * 设置左边view的drawableLeft * * @param drawableLeft 资源 * @return 返回 */ public CommonTextView setLeftDrawableLeft(Drawable drawableLeft) { if (drawableLeft != null) { drawableLeft.setBounds(0, 0, drawableLeft.getMinimumWidth(), drawableLeft.getMinimumHeight()); } if (leftTextView == null) { initLeftText(); } leftTextView.setCompoundDrawables(drawableLeft, null, null, null); return this; }
/** * 设置左边view的drawableTop * * @param drawableTop 资源 * @returnTop 返回 */ public CommonTextView setLeftDrawableTop(Drawable drawableTop) { if (drawableTop != null) { drawableTop.setBounds(0, 0, drawableTop.getMinimumWidth(), drawableTop.getMinimumHeight()); } if (leftTextView == null) { initLeftText(); } leftTextView.setCompoundDrawables(null, drawableTop, null, null); return this; }
/** * 设置左边view的drawableRight * * @param drawableRight 资源 * @return 返回 */ public CommonTextView setLeftDrawableRight(Drawable drawableRight) { if (drawableRight != null) { drawableRight.setBounds(0, 0, drawableRight.getMinimumWidth(), drawableRight.getMinimumHeight()); } if (leftTextView == null) { initLeftText(); } leftTextView.setCompoundDrawables(null, null, drawableRight, null); return this; }
/** * 设置左边view的drawableBottom * * @param drawableBottom 资源 * @return 返回 */ public CommonTextView setLeftDrawableBottom(Drawable drawableBottom) { if (drawableBottom != null) { drawableBottom.setBounds(0, 0, drawableBottom.getMinimumWidth(), drawableBottom.getMinimumHeight()); } if (leftTextView == null) { initLeftText(); } leftTextView.setCompoundDrawables(null, null, null, drawableBottom); return this; }
/** * 设置中间view的drawableLeft * * @param drawableLeft 资源 * @return 返回 */ public CommonTextView setCenterDrawableLeft(Drawable drawableLeft) { if (drawableLeft != null) { drawableLeft.setBounds(0, 0, drawableLeft.getMinimumWidth(), drawableLeft.getMinimumHeight()); } if (centerTextView == null) { initCenterText(); } centerTextView.setCompoundDrawables(drawableLeft, null, null, null); return this; }
/** * 设置右边view的drawableLeft * * @param drawableLeft 资源 * @return 返回 */ public CommonTextView setRightDrawableLeft(Drawable drawableLeft) { if (drawableLeft != null) { drawableLeft.setBounds(0, 0, drawableLeft.getMinimumWidth(), drawableLeft.getMinimumHeight()); } if (rightTextView == null) { initRightText(); } rightTextView.setCompoundDrawables(drawableLeft, null, null, null); return this; }
/** * 设置右边view的drawableRight * * @param drawableRight 资源 * @return 返回 */ public CommonTextView setRightDrawableRight(Drawable drawableRight) { if (drawableRight != null) { drawableRight.setBounds(0, 0, drawableRight.getMinimumWidth(), drawableRight.getMinimumHeight()); } if (rightTextView == null) { initRightText(); } rightTextView.setCompoundDrawables(null, null, drawableRight, null); return this; }
public static void setLeftDrawable(TextView textView, Drawable leftDrawable) { setDrawableBounds(leftDrawable); Drawable top = textView.getCompoundDrawables()[1]; Drawable right = textView.getCompoundDrawables()[2]; Drawable bottom = textView.getCompoundDrawables()[3]; textView.setCompoundDrawables(leftDrawable, top, right, bottom); }
public static void setBottomDrawable(TextView textView, Drawable bottomDrawable) { setDrawableBounds(bottomDrawable); Drawable left = textView.getCompoundDrawables()[0]; Drawable top = textView.getCompoundDrawables()[1]; Drawable right = textView.getCompoundDrawables()[2]; textView.setCompoundDrawables(left, top, right, bottomDrawable); }
public static void setCompoundDrawables(TextView textView, Drawable leftDrawable, Drawable topDrawable, Drawable rightDrawable, Drawable bottomDrawable) { setDrawableBounds(leftDrawable); setDrawableBounds(topDrawable); setDrawableBounds(rightDrawable); setDrawableBounds(bottomDrawable); textView.setCompoundDrawables(leftDrawable, topDrawable, rightDrawable, bottomDrawable); }
public static void setTopDrawable(TextView textView, Drawable topDrawable) { setDrawableBounds(topDrawable); Drawable left = textView.getCompoundDrawables()[0]; Drawable right = textView.getCompoundDrawables()[2]; Drawable bottom = textView.getCompoundDrawables()[3]; textView.setCompoundDrawables(left, topDrawable, right, bottom); }
public static void setRightDrawable(TextView textView, Drawable rightDrawable) { setDrawableBounds(rightDrawable); Drawable left = textView.getCompoundDrawables()[0]; Drawable top = textView.getCompoundDrawables()[1]; Drawable bottom = textView.getCompoundDrawables()[3]; textView.setCompoundDrawables(left, top, rightDrawable, bottom); }
public void setEmptyView(Context context, View emptyView, String text) { this.emptyView = emptyView; ((TextView) emptyView).setText(text); MaterialDrawableBuilder builder = MaterialDrawableBuilder.with(context) .setIcon(MaterialDrawableBuilder.IconValue.MUSIC_NOTE) .setColor(Config.textColorPrimary(context, Helpers.getATEKey(context))) .setSizeDp(30); ((TextView) emptyView).setCompoundDrawables(null, builder.build(), null, null); } }