How to bring tabs on the bottom

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to bring tabs on the bottom

Postby Archana » Thu Apr 16, 2009 6:08 am

Hi,

I have one doubt in Tabhost . I want the tabs to display at bottom instead of top programatically. i tried to use setGravity but its not working.. Please help me out from this.


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. protected void onCreate(Bundle savedInstanceState) {
  2.  
  3.         super.onCreate(savedInstanceState);
  4.  
  5.  
  6.  
  7.         TabHost tabHost = getTabHost();
  8.  
  9.      
  10.  
  11.         TabWidget tabWidget = new TabWidget(this);
  12.  
  13.         tabWidget.setId(android.R.id.tabs);
  14.  
  15.         tabWidget.setGravity(Gravity.BOTTOM);
  16.  
  17.         tabHost.addView(tabWidget, new LinearLayout.LayoutParams(
  18.  
  19.                   LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  20.  
  21.         tabHost.setup();
  22.  
  23.        
  24.  
  25.        LayoutInflater.from(this).inflate(R.layout.tabs1, tabHost.getTabContentView(), true);
  26.  
  27.      
  28.  
  29.      
  30.  
  31.        
  32.  
  33.         tabHost.addTab(tabHost.newTabSpec("")
  34.  
  35.                 .setIndicator("", getResources().getDrawable(R.drawable.pic1))
  36.  
  37.                  .setContent(new Intent(this, List1.class)));
  38.  
  39.        
  40.  
  41.         tabHost.addTab(tabHost.newTabSpec("")
  42.  
  43.                 .setIndicator("", getResources().getDrawable(R.drawable.pic2))
  44.  
  45.                  .setContent(new Intent(this, List2.class)));
  46.  
  47.        
  48.  
  49.         tabHost.addTab(tabHost.newTabSpec("")
  50.  
  51.                 .setIndicator("", getResources().getDrawable(R.drawable.pic3))
  52.  
  53.                  .setContent(new Intent(this, List3.class)));
  54.  
  55.        
  56.  
  57.         tabHost.addTab(tabHost.newTabSpec("")
  58.  
  59.                 .setIndicator("", getResources().getDrawable(R.drawable.pic4))
  60.  
  61.                  .setContent(new Intent(this, List4.class)));
  62.  
  63.     }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
Archana
Archana
Experienced Developer
Experienced Developer
 
Posts: 53
Joined: Thu Feb 28, 2008 12:00 pm
Location: Bangalore

Top

Postby ashish » Mon May 11, 2009 1:11 pm

hey does anybody know how to bring tabs at the bottom..i am facing the same problem
ashish
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Fri Feb 20, 2009 8:09 am

Postby VIDEN » Wed Jun 24, 2009 12:52 pm

Hey,

this belongs in the "View, Layout & Resource Problems" Section so Mods could you pls move it?

I have the same problem... It IS possible to just move the TabWidget down by filling padding from the top, but that isn't good programming so I won't do that...
I've seen a few people building their own Tab classes and I've seen quite a few bottom tabs in other Programs... so what solutions can you suggest? - What did the App Builders use?


Greets David
VIDEN
Developer
Developer
 
Posts: 32
Joined: Tue May 12, 2009 9:39 am
Location: Germany

Postby orit » Mon Sep 21, 2009 1:14 pm

Place the TabEidget under an AbsoluteLayout, there you have an option to determine the x and y layout of the tabs.
orit
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Sep 21, 2009 1:10 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests