How to make a similar google play viewpager?

Asked

Viewed 197 times

3

Expensive,

Does anyone know how to make a layout like google play? When Tablayout is selected, the viewpager changes the entire view, not just the bottom (or top)

I need to make the change this way. I can do a lot of it but it’s not the same.

I have to change the viewpage from above, with new images depending on the tablayout clickada.

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • 3

    Put your code friend, otherwise we can’t have any idea how you’re doing!

1 answer

1

This, it seems to me, is a viewpager that contains a set of imageviews, as well as a photo gallery. The viewpager obviously only takes half the screen (the viewpager acts as if it were a div of html). So the structure would be + or - like this:

 ---activity|---layoutDeCima----viewpager----imageviews
            |---layoutDeBaixo----tabs com 2 fragmentos dentro---cardviews

In the tabs onClick, kill the layoutDeCima viewpager and create a new.

I’m sorry I don’t paste code here. It’s because it’s practically an entire project. To make these tabs easier, I recommend this library: Smarttab For the white indicators, I recommend this: Circleindicator

  • I was already trying to do it this way. But I can’t "kill" the viewpager, and recreate it again. I’ve tried several methods but it doesn’t work. Only the data of the first Adapter appears which is set. I’m setting 2 Adapter, one for each Tab Selected

  • Have you created a Fragment for each tab or put it all into Mainactivity? Try creating a Fragment for each tab. Control each Fragment separately....

  • It’s being done like this. The problem is the viewpager, which is in Activity. Just press once, then when I try another Adapter, it no longer has an effect. Add more does not change.

  • 1

    used Adapter.notifyDataSetChanged(); ?

  • Yes. To think that this viewpeger needs to be in Fragment. It would be very strange

  • It is common to use viewpager in fragments in my opinion. At least I see no way to use it in this case other than in a fragment.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.