How good is the layout android design for this case? - android

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.

Related

Hidden view above existing view that contains a listview

As per screen 1, I have one Title view, and a listview below it,
I want to place a 'hidden view' above this 'title view' which will be visible only when I have scrolled this list till the top.
I have seen Hide your actionbar
and QuickReturnListView and ObservableScrollView
but as I understand none of them serves my purpose. Do anybody know how to achieve something like this?
You made one of the awesome question. I will just suggest creating one custom layout which will get added into the header of the ListView, and that custom layout contains these two views one is always 'visible' and other view in default 'gone' mode and while the time of refresh makes it 'visible'. or you can use addHeader method while on start and end refresh.
listView.addHeaderView(headerView);
I hope this suggestion will work, "Best of Luck...!!"
"Happy Coding...!!!"

align PageTabStrip according to the custom ViewPager content width

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.

Listview in scrollable layout

Don't use listviews in scrollviews they say, well, okay, but how do you fix this?
I have a viewpager with some lists in it (mockup)
above that, I have a tabindicator and some other information that doesn't change when you go to another tab.
My problem is that I always want to scroll the complete view (so content, tabindicator and viewpager).
If you scroll down, only the fragment with the listview (=tab content) should be visible and scrollable.
I don't want to put the content view and tab headers in a listview header because I don't want them to change every time I go to another tab (swipey tabs, so the user will see it)
What's the best way to do this?

Nested text view in android,with dynamic content

I want to display a recursive or nested text view at depth of 3 in Android.The text to be displayed is, dynamic coming from web service.
for example:
If I Click on Help(Level 1)
it'll show topics under Help
If I Click on Help_Topic_1(Level 2)
it'll show questions under Help_Topic_1
If I click on this question, say HT_Question_1(Level 3)
it'll show Answer of that question(Level 3)
how to accomplish with this? please guide me.
You should use ExpandableListView. Reference http://developer.android.com/reference/android/widget/ExpandableListView.html
You can call expandGroup and collapseGroup methods for expanding and collapsing on clicks.
the simplest way to do this is to have a nested layout structure. Your root view will contain the button to show level 1 and a child layout and initially be visible. The children's layout visibility will initially be set to "GONE". In the onclick listener for each button you change the visibility of the layout below it to view to "VISIBLE".
This of course is a very simple way of doing it. If you require to have open and close animations you'll need to use a more complex method.

how to order the elements in relative layout

friend's
I have a task to place the horizontal scroll or swipe menu tabs in my application i did it where the appears top of the header,but my problem is to place the scroll menu has below the header
i have RelativeLayout where it contains two elements one after another,
TextView - for header
Gallery - for Scroll menu items
from the above code Gallery content been set from my activity,
for example the output i'm getting
looks, scroll menus(Gallery) - Header
(text view defined the above layout)
========================================
but i need it has
Header (text view defined the above layout) -
scroll menus(Gallery)
how can i get it.
thanks in advance.
If you had read at least one time the documentation (the same way for what Maragues said, please mark question as answered when they are otherwise people will not answer you anymore) you should have seen that there are xml attributes to RelativeLayouts like android:layout_below ...
Check this link
Is there something about LinearLayout that makes it unsuitable?

Categories

Resources