Android 单击图像并打开ViewPager
我有一个用毕加索制作的图像旋转木马,它可以全屏显示图像。现在我需要一些占屏幕30%的图像,当我点击图像时,它会带来我的图像旋转木马 主要活动:Android 单击图像并打开ViewPager,android,Android,我有一个用毕加索制作的图像旋转木马,它可以全屏显示图像。现在我需要一些占屏幕30%的图像,当我点击图像时,它会带来我的图像旋转木马 主要活动: <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmln
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
您可以单击更改布局大小 ViewPager内部线性布局 AndroidImageSlider库可以用来实现滑块。 您必须更新到Viewpager2;Viewpager上的更新版本。
LinearLayout layout = findViewById(R.id.linearLayout);
LayoutParams params = layout.getLayoutParams();
params.height = 100;
params.width = 100;
layout.setLayoutParams(params);