android-tabhost

Get index of selected tab in tabHost

旧时模样 提交于 2019-11-30 09:12:00
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 documentation says it returns an int and setCurrentTab also taking an int. Does anyone know how I can get the index of my currently selected tab so I can restore it? Jorgesys you are on the right way, use setOnTabChangedListener to get your selected tab. public class MainActivity extends TabActivity { static TabHost mytabs; mytabs = getTabHost(); mytabs

How to create center raised tabbar?

ぐ巨炮叔叔 提交于 2019-11-30 07:55:24
I want to create the TabBar as like Below image: Here, all tab bar are normal. Just they are custom made. Now i want to create the Tab Bar as like above image. In which the center Tab is raised. So what should i have do to make it possible ? If is there any demo then it will be good. Please help me. you can set the Background image in Tab widget as tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.home_h); tabHost.getTabWidget().getChildAt(1).setBackgroundResource(R.drawable.live); tabHost.getTabWidget().getChildAt(2).setBackgroundResource(R.drawable.camera); tabHost

How to implement horizontally scrollable tabs?

為{幸葍}努か 提交于 2019-11-30 05:21:19
I'm trying to implement this application. At the moment I have designed tabs on it and since I have more than 7 tabs it looks too congested. How can I design it so that the tabwidget is scrollable horizontally. I have seen this design on few of the apps at the market but no clue how to implement this in my app. One app I saw had a horizontal scrollview where it scrolls on its own and when you press the particular image/button it displays some content. It didn't seem to be tabs I guess. So does anyone have an idea of this? Please check out Jake Wharton's ViewPager app. That is exactly what you

iPhone- like tab bar in Android?

送分小仙女□ 提交于 2019-11-30 04:57:47
In iPhone we can create a view that has a tab bar and make it the root view of the application then use the tab bar to navigate through sub views. what is the most close approach to this in Android? Is it to use a Tabbed Control? but this includes using just one activity. what is the approach to use in Android to create an activity with a navigation control to other activities in a way similar to that of the iPhone? binaryorganic There's a tutorial for creating a "Tab Layout" on the android dev site: You can implement your tab content in one of two ways: use the tabs to swap Views within the

How to switch tabs programmatically in Android from fragment?

风流意气都作罢 提交于 2019-11-30 04:54:53
I have implemented a TabActivity which extends FragmentActivity . It has 5 tabs each tab is a Fragment . What i am looking for is to switch between the tabs programmatically. For eg: if i am in tab4. On button click I want to move from tab4 to tab1 . Tried a lot but couldn't find the solution for this. Tried with the following but it doesn't help. From SecondTab public void switchTabInActivity(String value){ FirstTab parent; parent = (FirstTab) getActivity().getParent(); parent.switchTab(value); } TabActivity /** To Change Tab*/ public void switchTab(String tabno){ this.onTabChanged(tabno); }

FragmentTabHost - No tab known for tag null

我只是一个虾纸丫 提交于 2019-11-30 04:51:57
Few days ago I implemented TabHostFramgent in a Fragment with a NavigationDrawer , and I faced with a problem that is the following error : java.lang.IllegalStateException: No tab known for tag null The thing is that all works perfectly since my first item list of my NavigationDrawer is my TabHostFragment , so it works perfect, but the problem is when I go in example to the second item and then I want to go back to the first item, every time that I try so it crashes. I was searching everywhere, here in SO , code.google.com , etc... and I still don't get the proper answer. My tab_host_test_2

Android keyboard puts tab bar on top

拈花ヽ惹草 提交于 2019-11-30 04:24:54
问题 I have a little problem when I open keyboard in my application. I have a tab bar which is on bottom of page and in some situations, not always when I click on edit text and keyboard shows up, it's moving my tab bar on top of it. Here is an example : So my question is : Is there any way to disable this. I want my tab bar to stay hidden under keyboard when it shows up. Thanks in advance! 回答1: add these properties for your activity in manifest file: android:windowSoftInputMode="stateHidden

Android: How to call function of Activity inside of tab from the tabhost

随声附和 提交于 2019-11-30 04:22:43
问题 I have a tabhost with three tabs. Each is an activity. I would like to have a button which is in the action bar, the bar along the top with common buttons, call functions of the tab which is active. For example, an add function which could add something different to each tab depending on what tab was present when you clicked the button. So, I am aksing how to call a function in Activity A from the tabHost. And if that wont work, perhaps I can update the database from the tabhost and then

Badge on Android TabHost

蓝咒 提交于 2019-11-30 02:05:17
I want to implement the functionality same as was there in iPhone I implemented the custom Tabhost same as in iPhone in the bottom bar. I can set two Icons for Normal/Selected state but I need the dynamic icon with number of notifications as given in Image. Thanks Android ViewBadger may be the solution for you. (FYI, i haven't implemented it yet) Here is the snap you can have as an output by this solution: Muhammad Babar This is an example of How to add a badge in tab chat_tab.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="0dip" android

Android 1.6 & Fragment & Tabhost

一曲冷凌霜 提交于 2019-11-30 01:57:02
I'm working on upgrading an Android application (1.6 compatibility) which uses a TabHost to show 3 different tabs with nested activities. At the time I used the ActivityGroup trick to show nested activities in a tab but I'm very unhappy with this method since it's a real pain to handle some features. I heard about the Fragments API compatibility package for 1.6 and a Fragment looks perfect for what I want to do (show nested views / features within a tab with transition effects and stuff) but I can't make it work with a TabHost (It was meant to work with an Action Bar but it's not available in