File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Activity content overlapping TabView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Activity content overlapping TabView" Watch "Activity content overlapping TabView" New topic
Author

Activity content overlapping TabView

Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 245

Hello all,

I want to make an app with TabView. TabView contains 3 activities. My Activity layout is a ScrollView and overlapping the tabs at bottom. I am attaching the image of screen with tab.

Here is my xml file for TabView-

This is my xml file for activity contents-


[Thumbnail for error.png]



Astha - OCPJP 6 (90%)
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3934
    
  17

You have the Tabs and the Tab Content in the same FrameLayout, so when you put the content in, the tabs get covered. The TabWidget should go outside the FrameLayout and inside the LinearLayout, as it is not part of the tabcontent.


Steve
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 245

Steve Luke wrote:You have the Tabs and the Tab Content in the same FrameLayout, so when you put the content in, the tabs get covered. The TabWidget should go outside the FrameLayout and inside the LinearLayout, as it is not part of the tabcontent.

I tried this but now the tab is not visible.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1397
    
    6

Try putting bottom margin for the layout that appears on top of the tab widgets, and the margin height should be >= height of tab.


Swastik
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 245

I tried putting bottom margin in scroll view. It worked. Thanks
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3934
    
  17

The margin trick works, but is a bit fragile, since you are relying on the height of the other component. It isn't 'the right way' to do it. The problem is that your frame layout uses a 'fill_parent' height. If the frame fills the parent, where is the room for the tabs? Instead, you should make the tabs 'wrap_content' like they are, and not specify a height for the frame layout: instead, give them a height of 0dp, and a weight of 1 (which means it will get 1 'unit' of leftover layout space: since it is the only component needing leftover space it gets it all):
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 245

It worked perfectly Steve
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Activity content overlapping TabView
 
Similar Threads
Layout issue-footer image to the bottom of screen (Landscape & portrai) irrespective of body content
how to add a scrollbar to a view
Need Help on the scrolling Bar in Android?
Layouts, bottom position
regarding layout