Align the PageTabStrip to fit the custom width of the ViewPager content

I created PageTabStrip

and ViewPager

to show multiple list fragments. inside my content viewpager app has a certain width (it doesn't fill the whole screen) partial pages are visible.

since my content ViewPager

has a specific width, mine are PageTabStrip

not aligned accordingly.

see the image below, so how to align the title Division

below the first list and Item

below the second list (second tab exits the screen, see red)

! [enter image description here] [1]

+3


source to share


1 answer


I think you misunderstood the concept viewpager

and PageTabStrip

and misused them with design requirements.

viewpager

is a widget that shows each page one at a time, and when you sit down you can see other pages. The other pages are invisible until you pierce them, then he will show you one at a time.

PageTabStrip

will help you find which page is currently being displayed and what is the title of the next page and the previous page if you slide your finger over them so that it just suggests the next and previous page.

What your photo tells us is that you created a page and named it Division (as shown in the TabStrip page) and you put all your layouts inside it and you named the next section title ITEM, but I think if you swipe down screen to it, it is either empty, or simply duplicates the current view. Your problem is here, if you put all your layouts inside one page, you cannot set different headers for different parts of the current page, you can only set one header and that name refers to the entire location of the current page.



Here are my various solutions for presenting your layout:

1) Don't use pageTabStrip or give it a generic name like find and provide a subtitle for each part of the current layout, like linearlayout. This means add a linear scroll above the current page and split it and put each subtitle in the correct position.

2) Use the double pan pattern template and remove the viewer.

3) Move the search item type section to the next page.

+1


source







All Articles