本文整理了Java中android.graphics.drawable.Drawable.getMinimumWidth()
方法的一些代码示例,展示了Drawable.getMinimumWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.getMinimumWidth()
方法的具体详情如下:
包路径:android.graphics.drawable.Drawable
类名称:Drawable
方法名:getMinimumWidth
暂无
代码示例来源:origin: bumptech/glide
@Override
public int getMinimumWidth() {
return wrapped.getMinimumWidth();
}
代码示例来源:origin: facebook/litho
@Override
public int getMinimumWidth() {
return mDrawable.getMinimumWidth();
}
代码示例来源:origin: facebook/litho
@Override
public int getMinimumWidth() {
return mDrawable.getMinimumWidth();
}
代码示例来源:origin: rey5137/material
@Override
public int getMinimumWidth() {
return (mDrawable != null ? mDrawable.getMinimumWidth() : 0) + mPaddingLeft + mPaddingRight;
}
代码示例来源:origin: facebook/litho
@Override
public int getMinimumWidth() {
return mDrawable == null ? UNSET : mDrawable.getMinimumWidth();
}
代码示例来源:origin: seven332/EhViewer
public int getMinimumWidth() {
return this.mDrawable.getMinimumWidth();
}
代码示例来源:origin: yanzhenjie/NoHttp
public static void setDrawableBounds(Drawable drawable) {
if (drawable != null)
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
}
代码示例来源:origin: bm-x/PhotoView
private static int getDrawableWidth(Drawable d) {
int width = d.getIntrinsicWidth();
if (width <= 0) width = d.getMinimumWidth();
if (width <= 0) width = d.getBounds().width();
return width;
}
代码示例来源:origin: Hitomis/transferee
private static int getDrawableWidth(Drawable d) {
int width = d.getIntrinsicWidth();
if (width <= 0) width = d.getMinimumWidth();
if (width <= 0) width = d.getBounds().width();
return width;
}
代码示例来源:origin: square/assertj-android
public S hasMinimumWidth(int width) {
isNotNull();
int actualHeight = actual.getMinimumWidth();
assertThat(actualHeight) //
.overridingErrorMessage("Expected minimum width <%s> but was <%s>.", width, actualHeight) //
.isEqualTo(width);
return myself;
}
代码示例来源:origin: smuyyh/BookReader
@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);
}
代码示例来源:origin: bm-x/PhotoView
private boolean hasSize(Drawable d) {
if ((d.getIntrinsicHeight() <= 0 || d.getIntrinsicWidth() <= 0)
&& (d.getMinimumWidth() <= 0 || d.getMinimumHeight() <= 0)
&& (d.getBounds().width() <= 0 || d.getBounds().height() <= 0)) {
return false;
}
return true;
}
代码示例来源:origin: Hitomis/transferee
private boolean hasSize(Drawable d) {
if ((d.getIntrinsicHeight() <= 0 || d.getIntrinsicWidth() <= 0)
&& (d.getMinimumWidth() <= 0 || d.getMinimumHeight() <= 0)
&& (d.getBounds().width() <= 0 || d.getBounds().height() <= 0)) {
return false;
}
return true;
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@Override
public int getMinimumWidth() {
if (mDrawableContainerState.isConstantSize()) {
return mDrawableContainerState.getConstantMinimumWidth();
}
return mCurrDrawable != null ? mCurrDrawable.getMinimumWidth() : 0;
}
代码示例来源:origin: eleme/UETool
private void updateCustomView() {
final CustomView customView = findViewById(R.id.custom);
customView.setMoreAttribution("more attribution");
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_up_vote);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
customView.setCompoundDrawables(null, drawable, null, null);
}
}
代码示例来源:origin: lygttpod/SuperTextView
/**
* 设置中间view的drawableBottom
*
* @param drawableBottom 资源
* @return 返回
*/
public CommonTextView setCenterDrawableBottom(Drawable drawableBottom) {
if (drawableBottom != null) {
drawableBottom.setBounds(0, 0, drawableBottom.getMinimumWidth(), drawableBottom.getMinimumHeight());
}
if (centerTextView == null) {
initCenterText();
}
centerTextView.setCompoundDrawables(null, null, null, drawableBottom);
return this;
}
代码示例来源:origin: lygttpod/SuperTextView
/**
* 设置右边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;
}
代码示例来源:origin: smuyyh/BookReader
private void initCollection(boolean coll) {
if (coll) {
mBtnJoinCollection.setText(R.string.book_detail_join_collection);
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.book_detail_info_add_img);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
mBtnJoinCollection.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.shape_common_btn_solid_normal));
mBtnJoinCollection.setCompoundDrawables(drawable, null, null, null);
mBtnJoinCollection.postInvalidate();
isJoinedCollections = false;
} else {
mBtnJoinCollection.setText(R.string.book_detail_remove_collection);
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.book_detail_info_del_img);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
mBtnJoinCollection.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.btn_join_collection_pressed));
mBtnJoinCollection.setCompoundDrawables(drawable, null, null, null);
mBtnJoinCollection.postInvalidate();
isJoinedCollections = true;
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void getDrawable_mipmapReferencesResolve() {
Drawable reference = resources.getDrawable(R.mipmap.mipmap_reference);
Drawable original = resources.getDrawable(R.mipmap.robolectric);
assertThat(reference.getMinimumHeight()).isEqualTo(original.getMinimumHeight());
assertThat(reference.getMinimumWidth()).isEqualTo(original.getMinimumWidth());
}
代码示例来源:origin: robolectric/robolectric
@Test
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
@Config(minSdk = Build.VERSION_CODES.O)
public void getDrawable_mipmapReferencesResolveXml() {
Drawable reference = resources.getDrawable(R.mipmap.robolectric_xml);
Drawable original = resources.getDrawable(R.mipmap.mipmap_reference_xml);
assertThat(reference.getMinimumHeight()).isEqualTo(original.getMinimumHeight());
assertThat(reference.getMinimumWidth()).isEqualTo(original.getMinimumWidth());
}
内容来源于网络,如有侵权,请联系作者删除!