简体   繁体   中英

Android Studio ScrollView only show visible images

I've created a scrollview that scrolls through images, but even if some of the images aren't visible it still scrolls as if they were. Is there a way to make the scroll only scroll through the visible images?

Put the following line in imageview xml

android:visibility="gone"

Then the full code like this

<ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    android:src="@drawable/image" />

As well as you can also do that with programmatically.

ImageView imageview = findViewById(R.id.imageView);
imageview.setVisibility(View.GONE); 

Hope you helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM