align PageTabStrip according to the custom ViewPager content width - android

I have created PageTabStrip and ViewPager to show multiple list fragments. inside my app viewpager content has a specific width ( it doesn't occupy the whole screen ) partial pages are visible.
as my ViewPager content has specific width, my PageTabStrip are not aligned accordingly.
please see the image below , so how do i align the Division caption under first list and Item under second list ( second tab is getting out of the screen , see in red)
![enter image description here][1]

I think you misunderstand the concept of viewpager and PageTabStrip and misused them with your design requirement.
The viewpager is a widget that shows each page one at a time and when you swipe you can see the other pages. Other pages are all invisible until you swipe to them, then it shows you one at a time.
The pageTabStrip helps you to find that which page is currently displayed and what is the title of the next page and previous page if you swipe to those, so it just gives a hint about next and previous pages.
What your picture tells us is you have created a page and set its title Division,(as the pageTabStrip shows) and you have put all of your layouts inside it and you called the next page title ITEM but I think if you swipe to it, it is either empty or just duplicates current view. Your problem is here, if you put all your layouts inside one page you can not set different title for different part of current page, you only can set one title and this title applies to whole layout of current page.
Here is my different solutions to represent your layout:
1) Do not use pageTabStrip or give it a general title for example Search and provide a sub title for each part of current layout with for example linearlayout. It means add a linearlayout above the current page and divide it and put each subtitle in a correct position.
2) Use dual pan fragment design pattern and remove the viewpager.
3) Move search item type section to the next page.

Related

How good is the layout android design for this case?

I have a design with header and footer (not fixed) scrolling with a content that is longer than the height of the screen.
Question 1. When I click the button on screen 1, content 1 will be replaced by content 2. footer and header remain the same.
Question 2. header and footer both have their own events, how can I reuse those events and only write code once?
Design what Views and View groups are suitable for this case, please help me. Currently I use Scrollview as container then replace content 1 with frament containing content 2.
ViewPager may be good for you. You can define 2 sub pages for the view pager, and when button on page 1 is clicked, advance the view pager to the next page.

How not to wrap the Tab Titles in Swipe View?

I am trying to create swipe able views in android.
But since titles of my Tabs are longs they are getting wrapped to fit in single screen.
How to avoid the wrapping of titles and let the titles extend in one line even if the tab titles has to expand outside the current screen.
Seen Image Here
There is an Android component for that called PagerTitleStrip: http://developer.android.com/training/implementing-navigation/lateral.html#PagerTitleStrip
This will provide you fully-visible scrollable tabs.

Suggestion for implementing layout

I am working on a android app. Requirement of app is to support multiple screen sizes. When I was going through tablet layout of app, I found something like this:
Here, as you can see, there are two fragments. Left side contains a listview and right side fragment contains detailed content of selected listveiew item. now problem is: How do I move the arrow (selected with red mark) up and down accordance to item selected in listView??
Check out this answer. You could make the arrow part of the list view fragment but make it visually blend with the content view.

android animating views between pages

I have been researching for the same since two days. Here is what i want to achieve. I havent ever tried much animations in android so please clear my approach wherever required. I will have two pages/screens (one visible at a time) Now when I am on page1, on swiping right to left page 2 will be displayed (achieving this is not that difficult) But here is my problem : when I am scrolling to page2 i would like to animate/translate/slide an image from page1 to page2 (without touching the image) and let the image sit on page2. I am just not sure of how to start with this.
I have thought of few ideas
First: I think i should implement a layout larger then window and then do the required animations and scrolling in it using horizontal scrollview.But now here I am not sure how will I make it look like they are 2 different pages(concerned about handling different screen sizes)
Second:I have seen example libraries of draggable gridview viewpager. But here both of my pages will have different layouts
Third:I am thinking of dividing both of my pages. the lower part of my pages will contain framelayout where I will only change the framelayout's content on scroll and perform hide n show trick on the upper part.But here again the trick is how am I supposed to place the image(contained in framelayout) to upper layout with an animation(image sliding to the top side on its own kind of animation)
Any Ideas. Any views/suggestions. Need all of it.Thank You for your valuable time.
This happens when I am trying to move the image to screen's top-left position. It moves in the left top direction as shown in the images below..
This happens when I am trying to move it besides second fragment textview
But the problem is I want to move it besides second fragment textview while scrolling and when scrolling is done it should come to top left of the screen just like the second fragment textview

Sliding effect page dynamically

First of all, I search on forum title about sliding page and I am not using fragment view. I have one xml layout and one java document.
Xml includes one textview and one imageview also one prev and one next button.
In java file, I have and array and it includes letters: a,b,c...
My problem is that when I clicked next button, my textview and imageview will changed with sliding animation. How can I do it?
Thanks.
Maybe my answer to: How to animate a slide in notification view that pushes the content view down can be of help.
It slides a View nicely into the screen while pushing the other layout down.
Think same process could be applied to what you want.

Categories

Resources