Questions tagged [android-tabhost]

Display a sub list of tab labels representing each page in the parent's tab collection.

Displays a list of tab labels representing each page in the parent's tab collection. The container object for this widget is TabHost. When the user selects a tab, this object sends a message to the parent container, TabHost, to tell it to switch the displayed page. You typically won't use many methods directly on this object. The container TabHost is used to add labels, add the callback handler, and manage callbacks.

Reference: Android Developers Tabhost

2122 questions
11
votes
5 answers

Android remove space between tabs in tabwidget

I have made an application which has tabs like in HelloTabActivity, there is also space between these tabs, can anyone suggest how to remove this space and also there is a grey line beneath the tabs how can that be removed? main.xml
11
votes
7 answers

Android - Tabhost working in Activity class

OK, I must be overlooking something silly because I am unable to get my tabhost to display in my Activity class. I am getting the dreaded force close when I try to run the app. It will work if i extend TabActivity, but I can't do that [see edit…
bursk
  • 1,647
  • 7
  • 25
  • 39
11
votes
2 answers

TabHost displays content once (onCreate)

I have a TabHost Inside a navigationDrawer and I'm facing this weird problem which occurs when ever i go from TabHost which exist as a navigation drawer item to another navigation drawer item and get back to TabHost it won't display its content, the…
Ahmad Sanie
  • 3,678
  • 2
  • 21
  • 56
11
votes
6 answers

onActivityResult not call in the Fragment

The structure of the app is like this: tabHost (in Activity) -> contains -> TabFragment(extend base container fragment) 1. The code in Activity: tabHost.addTab( tabHost.newTabSpec("home").setIndicator("", …
11
votes
3 answers

Android TabHost tabs steal focus when using Hardware Keyboard

I currently have a TabHost containing 4 tabs. On a few of the fragments we have a number of EditText views within the layout. We have noticed that when you attempt to type into any of the EditText views using the hardware keyboard, the focus is…
Michael Muesch
  • 173
  • 1
  • 5
11
votes
5 answers

NullPointerException in oncreateView() of Fragment

This code below shows part of activity where the fragment is added. FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.fragment_container, srkt_frag); …
10
votes
5 answers

StateListDrawable to switch colorfilters

I want to create custom buttons to use in a TabHost. I haven been trying to just use the same image resource (png), but have the colorfilter change depending on the state. So I made this bit to serve as the layout for the custom button:
Mopper
  • 1,677
  • 2
  • 18
  • 41
10
votes
3 answers

Tab with icon using TabLayout in Android Design Library

I'm trying to use the new TabLayout in the android design library to create app bar with icons only. like this: how can I do it using the new TabLayout Android Design Library. is there a simple solution for this, or i have to use the setCustomView…
10
votes
5 answers

java.lang.IllegalStateException: No activity

I'm building an Android app for which I'd like my first activity to be composed of 2 tabs, one for the user's profile, and one for the friends' activity. For these tabs, I opted for a TabHost since my Sherlock Action Bar is already using list…
2Dee
  • 8,609
  • 7
  • 42
  • 53
10
votes
1 answer

Android: TabHost - passing Parameters to Fragments

I am working on a TabHost with a WebView inside of each Fragment. What I do is: for(int i = 0; i < numberOfTabs; i++){ mTabManager.addTab(mTabHost.newTabSpec(tabNames[i]).setIndicator(tabNames[i]), Web.class, null); } How…
Bins Ich
  • 1,822
  • 6
  • 33
  • 47
9
votes
3 answers

Drawing number badge like iPhone in Android

I want to draw the number badge as shown in the above image on the Chats tab. That number badge shows number of new unread messages in chat. So how can I draw this kind of custom number badge. Is there any inbuilt API in Android SDK? Thanks in…
Darshan Prajapati
  • 843
  • 2
  • 11
  • 33
9
votes
3 answers

Get index of selected tab in tabHost

I'm trying to store the index of the currently selected tab in onSaveInstanceState so I can restore it. However the getCurrentTab apparantely gives me back the String I used in the etTabHost().newTabSpec, which I find a bit weird since the…
Jack
  • 91
  • 1
  • 1
  • 2
9
votes
4 answers

Starting an AnimationDrawable in Android

Where should I start an AnimationDrawable that needs to animate when the activity is shown? The developer guide recommends using onWindowFocusChanged, but this isn't always called when the activity is part of a TabHost. I quote: It's important to…
hpique
  • 119,096
  • 131
  • 338
  • 476
9
votes
4 answers

Update tabs from a tab's activity in a Android TabHost

I have a TabActivity and am going to have 3 or 4 tabs. In TabA, I would like to have an ExpandableListView, which will list products. I would like TabC to act as a sort of "shopping cart", probably with a ListView of itself. Is there a way to…
9
votes
4 answers

How to get the content of a Tab within a TabHost?

I have an Activity defined by:
nKn
  • 13,691
  • 9
  • 45
  • 62