我有 String str2 = "/EMOTIONS_TAX/29027000/Points Of Interest/totem,"
+ "/EMOTIONS_TAX/29044000/Places/Italia,"
+ "/EMOTIONS_TAX/29027000/Military Equipment";
Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher(str2);
while(matcher.find()) {
System.out.println(matcher.group());
}
的图片在29027000
29044000
29027000
中,
使用滑行加载图像。在RecyclerView
事件中,我开始一个新的活动:
CardView
但是,如果图像没有时间加载,那么当您返回此活动时,此onClick()
将为空。
在清单中:
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val text = layout!!.findViewById<View>(R.id.item_text) as TextView
val card = layout!!.findViewById<View>(R.id.item_card) as CardView
val img = layout!!.findViewById<View>(R.id.item_image) as ImageView
val requestOptions = RequestOptions()
requestOptions.placeholder(R.drawable.placeholder)
Glide.with(this.activity.applicationContext).setDefaultRequestOptions(requestOptions).load(mDataset[position].urlToImage).into(img)
text.text = mDataset[position].title
card.setOnClickListener {
val intent = Intent(activity, ArticleActivity::class.java)
intent.putExtra("Title", mDataset[position].title)
intent.putExtra("Author", mDataset[position].source.name)
intent.putExtra("Text", mDataset[position].description)
img.transitionName = "item_image"
intent.putExtra("urlToImage", mDataset[position].urlToImage)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this.activity, img as View, "item_image")
this.activity.startActivity(intent, options.toBundle())
}
}
在按下硬件后退按钮时也发生这种情况,同时也单击工具栏的后退按钮。
已解决:
ImageView
答案 0 :(得分:0)
滑行加载线/ GlideModule(如果有)/列表适配器代码(如果有):
这是我在使用该库进行反复试验的过程中使用的配置之一。我已经尝试过
.skipMemoryCache(true), .diskCacheStategy
使其正常工作
Glide.with(itemView.getContext())
.load(groupPhotos.getImg_url()) // simple url with an image
.asBitmap()
.placeholder(R.drawable.jaya_grocer)
.error(R.drawable.cold_storage)
.dontAnimate()
.into(iv_image);
布局XML:
<ImageView
android:id="@+id/iv_list_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@+id/tv_list_members"
android:layout_marginTop="@dimen/std_padding"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/default_group_5" />
答案 1 :(得分:0)
您可以使用 statusdata.php
滑行从Glide缓存中加载图像
.diskCacheStrategy(DiskCacheStrategy.ALL)