刷新二维码,轮播图嵌套cardview(不美观)

This commit is contained in:
huangrui 2024-05-28 17:02:24 +08:00
parent 57a17db5e7
commit b38c5e95ee
8 changed files with 51 additions and 11 deletions

View File

@ -59,4 +59,10 @@ dependencies {
implementation ("com.geyifeng.immersionbar:immersionbar-components:3.2.2")
implementation ("com.belerweb:pinyin4j:2.5.1")
//androidX
// implementation ("com.github.lzjin:ViewPagerGallery:1.2")
// implementation ("com.github.lzjin:ViewPagerGallery:1.3")
}

View File

@ -40,23 +40,36 @@ public class ShouyeFragment extends Fragment {
list.add("https://alifei03.cfp.cn/creative/vcg/800/new/VCG211366776934.jpg");
list.add("https://alifei02.cfp.cn/creative/vcg/800/new/VCG211430222848.jpeg");
Banner banner = view.findViewById(R.id.banner);
CardView cardView = view.findViewById(R.id.cardview);
ImageView imageView = view.findViewById(R.id.imageView41);
banner.setAdapter(new BannerImageAdapter<String>(list) {
@Override
public void onBindView(BannerImageHolder holder, String data, int position, int size) {
Glide.with(holder.itemView)
.load(data)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(30)))
.into(holder.imageView);
.into(imageView);
}
});
banner.setIndicator(new CircleIndicator(getContext()));
banner.setIndicatorRadius(5);
banner.setBannerGalleryEffect(10,10,3) ;
banner.setBannerRound(30);
// banner.setPageChangeDuration(800); // 滑动时的动画时间
// banner.setDelayTime(3000); // 自动切换的时间间隔
banner.setScrollTime(800);
// banner.initBanner(urlList, true)//开启3D画廊效果
// .addPageMargin(10, 50)//参数1page之间的间距,参数2中间item距离边界的间距
// .addPointMargin(6)//指示器点间距
// .addStartTimer(8)//自动轮播5秒间隔
// .addPointBottom(7)//底部间距
// .addRoundCorners(12)//圆角
// .finishConfig()//这句必须加
// .addBannerListener(new BannerViewPager.OnClickBannerListener() {
// @Override
// public void onBannerClick(int position) {
// //点击item
// }
// });
message.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -36,14 +36,20 @@ public class TakeSubwayFragment extends Fragment {
shakeAnimation.setDuration(500); // 设置动画持续时间
shakeAnimation.setRepeatCount(-1); // 设置重复次数-1为无限重复
shakeAnimation.setRepeatMode(Animation.REVERSE); // 设置重复模式使其来回摇晃
//
ImageView ma = view.findViewById(R.id.imageView71);
ma.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ma.setSelected(true);
}
});
// // 应用动画
imageViewRightTop.startAnimation(shakeAnimation);
ConstraintLayout shang = view.findViewById(R.id.constraintLayout2);
CardView zhong = view.findViewById(R.id.zhong);
ConstraintLayout zhong1 = view.findViewById(R.id.zhong1);
ConstraintLayout xia = view.findViewById(R.id.constraintLayout11);
ConstraintLayout background = view.findViewById(R.id.background);
//todo 点击三点水
ImageView more = view.findViewById(R.id.imageView75);
@ -88,7 +94,6 @@ public class TakeSubwayFragment extends Fragment {
// zhong1.setBackgroundColor(0xFF747474);
// zhong.getBackground().setAlpha(128);
xia.getBackground().setAlpha(128);
// background.getBackground().setAlpha(128); // 128是50%透明度的值
}
});
@ -102,7 +107,6 @@ public class TakeSubwayFragment extends Fragment {
shang.getBackground().setAlpha(255);
zhong1.getBackground().setAlpha(255);
zhong.getBackground().setAlpha(255);
xia.getBackground().setAlpha(255);
// zhong1.setBackgroundColor(R.color.white);
}
});
@ -116,7 +120,6 @@ public class TakeSubwayFragment extends Fragment {
shang.getBackground().setAlpha(255);
zhong1.getBackground().setAlpha(255);
zhong.getBackground().setAlpha(255);
xia.getBackground().setAlpha(255);
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ma2" android:state_selected="false"/>
<item android:drawable="@drawable/ma22" android:state_selected="true"/>
</selector>

View File

@ -82,7 +82,20 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent" >
<androidx.cardview.widget.CardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="10dp" >
<ImageView
android:id="@+id/imageView41"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/out" />
</androidx.cardview.widget.CardView>
</com.youth.banner.Banner>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"

View File

@ -106,7 +106,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/saoma" />
app:srcCompat="@drawable/refresh_ma" />
<TextView
android:id="@+id/textView206"