轮播图图片方式
This commit is contained in:
parent
d020bae8ea
commit
99ad92cc90
@ -75,8 +75,6 @@ ext {
|
||||
//Rxjava
|
||||
gRxJavaVersion = '2.2.7'
|
||||
gRxAndroid = '2.1.1'
|
||||
//Glide
|
||||
gGlideVersion = '4.11.0'
|
||||
//Okhttp
|
||||
gOkHttp3Version = '4.5.0'
|
||||
//EventBus
|
||||
@ -112,6 +110,7 @@ ext {
|
||||
supportGson = '2.8.5'
|
||||
//Glide
|
||||
supportGlide = '4.11.0'
|
||||
|
||||
gSmartRefreshLayoutVersion = '1.1.2'
|
||||
leonidslibVersion = '1.3.2'
|
||||
ijkPlayer = '0.8.8'
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.base;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -12,7 +15,10 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
* 描述:
|
||||
*/
|
||||
public class BannerHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView mIvContent;
|
||||
|
||||
public BannerHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mIvContent = itemView.findViewById(R.id.iv_content);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.base;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@ -11,6 +13,7 @@ import com.sucstepsoft.cm_utils.core.beans.BaseImageBean;
|
||||
import com.sucstepsoft.cm_utils.utils.ConvertUtils;
|
||||
import com.youth.banner.adapter.BannerAdapter;
|
||||
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -27,13 +30,14 @@ public class BaseBannerImageAdapter extends BannerAdapter<BaseImageBean, BannerH
|
||||
|
||||
@Override
|
||||
public BannerHolder onCreateHolder(ViewGroup parent, int viewType) {
|
||||
ImageView imageView = new ImageView(parent.getContext());
|
||||
//注意,必须设置为match_parent,这个是viewpager2强制要求的
|
||||
imageView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
return new BannerHolder(imageView);
|
||||
// ImageView imageView = new ImageView(parent.getContext());
|
||||
// //注意,必须设置为match_parent,这个是viewpager2强制要求的
|
||||
// imageView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
// ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
// imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_banner_layout, parent, false);
|
||||
return new BannerHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,11 +50,10 @@ public class BaseBannerImageAdapter extends BannerAdapter<BaseImageBean, BannerH
|
||||
.placeholder(R.drawable.ic_img_default_banner)
|
||||
.transform(roundedCornersTransform)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE);
|
||||
ImageView image = (ImageView) holder.itemView;
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.asBitmap()
|
||||
.load(data.getImgUrl())
|
||||
.apply(options)
|
||||
.into(image);
|
||||
.into(holder.mIvContent);
|
||||
}
|
||||
}
|
||||
|
12
cm_utils/src/main/res/layout/item_banner_layout.xml
Normal file
12
cm_utils/src/main/res/layout/item_banner_layout.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY" />
|
||||
</LinearLayout>
|
@ -213,11 +213,6 @@ public class LegacyDetailActivity extends BaseActivity {
|
||||
adapter.notifyDataSetChanged();
|
||||
mIvCover.setDelayTime(3000);
|
||||
mIvCover.start();
|
||||
// Glide.with(mActivity)
|
||||
// .asBitmap()
|
||||
// .load(BaseUrlApi.BASE_LEGACY_IMG_URL + bean.getLibraryCover())
|
||||
// .apply(mOptions)
|
||||
// .into(mIvCover);
|
||||
}
|
||||
|
||||
mTvTitle.setText(bean.getLibraryTitle());
|
||||
|
Loading…
Reference in New Issue
Block a user