- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试使用 GlideLibrary 加载占位符图像,我正在使用 SimpleTarget。占位符图像未加载,但来自 url 的图像正在加载。我搜索了很多,也使用了 RequestOptions。不过,它似乎没有用。
代码如下:
Glide.with(mContext).load("https://i.imgur.com/0k7ZFWr.png").apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon)).into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
我正在使用 Glide 库 4.7.1。我也尝试过使用 setDefaultRequestOptions() - 不工作。
我的卡片 View XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/category_cardview"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#FFBF41"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/cardImageLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="60dp"
android:orientation="vertical">
<TextView
android:id="@+id/category_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="bottom"
android:paddingLeft="5dp"
android:shadowColor="#f3848383"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
android:text="WEAPONS"
android:textColor="@color/colorWhite"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3"
android:background="#000"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/category_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="11dp"
android:text="Know your weapons before you shoot"
android:textColor="@color/colorLightWhite"
android:textScaleX="1" />
</LinearLayout>
<com.romainpiel.shimmer.ShimmerTextView
android:id="@+id/arrow_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="0.2"
android:gravity="right"
android:text=">>>>>"
android:textColor="#000"
android:textScaleX="1.5"
android:textStyle="bold"
app:reflectionColor="#FFBF41" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
最佳答案
你可以用 Glide (4.7.1) 喜欢这个
Glide.with(getActivity()).load(avatar)
.apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.mipmap.defaultusericon))
.into(mUserIcon);
关于android - Glide 4.7.1 占位符未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51890846/
我的 DateTime 对象使用 DateTime.Now 分配了本地时间。我想知道一旦夏令时开始/结束,这个对象是否会给出正确的当前本地时间。或者我需要解决方法吗? 最佳答案 是的,DateTime
假设我需要“特定类别中可用的项目数量”与“所有项目的数量”的比率。请考虑这样的 MySQL 表: /* mysql> select * from Item; +----+------------+--
我有这张 table http://codepen.io/MetCastle/pen/lxceL我想使用 jQuery 根据 input type="number" 隐藏/显示列。表示整个列: Pro
想要制作一个看起来像这样的网格,其中 div/section 以百分比表示。 margin 在任何地方都是一样的。 http://www.ladda-upp.se/bilder/giefekcmgwm
这将返回 1(又名 TRUE) SELECT DATE_SUB(NOW(), INTERVAL 24*100 HOUR) = DATE_SUB(NOW(), INTERVAL 100 DAY); 10
我一直在尝试在 UIScrollView 中获取 UIView 的转换后的 CGRect。如果我不放大它就可以正常工作,但是一旦我放大,新的 CGRect 就会发生变化。这是让我接近的代码: CGFl
对于家庭作业,我需要在不使用内置模 (%) 运算符的情况下返回 num1 除以 num2 后的余数。我能够通过以下代码让大多数测试通过,但我仍然坚持如何解释给定数字的 -/+ 符号。我需要保留 num
我用 Javascript 创建了一个倒数计时器;它是成功的,期望未完成。事实上,从数学上讲,它是正确的,但是谷歌浏览器的浏览器设置“暂停”(因为没有更好的术语)SetInterval/Timeout
我有两个 的,每个都设置为其容器宽度的 45%。有没有办法使 居中?使得它们在容器的左右两侧有相同的空间,并且它们之间也有空间。 一开始我只是做了每个 50% 并且有 padding: 0px 2
我是一名优秀的程序员,十分优秀!