android-tabhost

'Unselect' a tab in a TabHost

ぐ巨炮叔叔 提交于 2019-12-04 19:33:22
I have a TabHost holding 5 tabs. As far as I can see, there has to be one tab selected at all times. I need a way to unselect all my tabs so none will be selected. If the tabhost is meant by general to have one tab selected at all times, how can I make it appear (UI speaking) as if the tab isn't selected? This is not possible AFAIK. but yes,you can set the selected tab's color to look like it is unselected and set a blank layout over it by managing a global variable when you make it 'unselected' and setting up normal layout when you want it to be shown normally to user. But this is kind of a

EditText and TabHost do not like each other

北战南征 提交于 2019-12-04 18:07:42
问题 I have a layout with EditText and TabHost containing 2 tabs. Android 1.6. I use hardware keyboard in following case. Steps to reproduce: When activity is displayed the EditText gains focus. As soon as I press any key the EditText loses focus and first tab gains it. I click on the EditText again and start typing. It works unless I press any numeric button. The first tab gains the focus again. I scroll back to the EditText with track ball. I can type anything now. Using track ball left/right on

How do I change the color used to indicate a tab has been selected on a TabHost?

淺唱寂寞╮ 提交于 2019-12-04 15:59:20
On the android TabHost layout , when the user selects a tab the color of the tab changes temporarily. How do I either disable this color change, or specify the color that the tab changes to? UPDATED Instead of making an own example and taking credit for it, I found my old bookmarked tutorial. How to change background on Android Tabs I'll suggest you to implement your own tab_indicator_selector.xml. Example: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states ... --> <!-- Focused states ... --> <!-- Pressed -->

Communicate with a fragment in a FragmentTabHost

会有一股神秘感。 提交于 2019-12-04 15:02:26
I want to communicate with a fragment in a FragmentTabHost The communication Fragment->Activity is done! With an interface. But I can't create a communication Activity->Fragment because I created the fragment like this: mTabHost.addTab( mTabHost.newTabSpec("tab2").setIndicator("Affichage", getResources().getDrawable(android.R.drawable.star_on)), MySelectionFragment.class, null); MySelectionFragment is a class not a fragment like new MySelectionFragment() And I dunno how to communicate with a class :/ Thanks in advance! The trick was to override the onAttach method like this: @Override public

MapActivity in TabHost Fragment disappearing after tab switch

半腔热情 提交于 2019-12-04 14:13:00
问题 I'm trying to display a map in a set of tabs, using fragments. The problem I'm having is the map activity disappears if the user navigates to another fragment, then back. How can I display a MapActivity in fragments in a tabhost? The basis for this is from the numerous questions around how to integrate a MapActivity with fragments (see MapView in a Fragment (Honeycomb)) MainTabActivity has a tabhost and uses FragmentManager to display Fragments in the tabs. MapFragment has a tabhost and uses

Android Tabhost Problem - .setIndicator

二次信任 提交于 2019-12-04 12:37:44
First let me clarify that i have already referred the SO question related to "Android - TAbhost". I have done googling about "Android Tabhost" but failed to find the solution. My problem is: If are having <3 tabs then it is fine. but Supporse if we are having 4 tabs with indicator title as TabHost1, TabHost2, TabHost3, TabHost4). But this title in Tab does not get fitted with tab. so is there any way to fit the Title Text (i.e. indicator) inside the tab ?? I thought the source of our issue was somewhere in the framework's code. And sure enough, I found some clues : First, if you look inside

How to launch an activity with a specific tab?

耗尽温柔 提交于 2019-12-04 12:36:51
问题 I've gone through many examples, questions and tutorials but I've never seen an activity launch (launch a new intent) with a specific tab. I know that one can use .setCurrentTab to switch to a tab, but this can be done only from inside the parent activity tab. How about launching a specific tab contained in one activity from a different activity? Is it possible? If so, then how? In my code, on a standard activity launch user is shown the first tab, but I want him to go to the fourth tab in

adding tabs dynamically in android

牧云@^-^@ 提交于 2019-12-04 12:21:41
in my application i want to add tabs dynamically ob click of button.how can i add? the rest gui shoul be same as it is.only tabs should be added. here is xml file- <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/Beige" android:focusable="true" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout3" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/linearLayout2"

saving data on tabs

故事扮演 提交于 2019-12-04 06:07:05
问题 I have 3 tabs, each a separate activity. I want to save data when user clicks save on either of the tabs. There are couple of options available; shared preference, global variables or saving the objects in context. EDIT:I have to save an image & textfield Android Shared Preferences Store Objects in ApplicationContext Any suggestions on which method to pick ? thanks 回答1: That is entirely dependent upon the length of time you wish to store them for. Storing in the Application Context will not

Create Smaller Tabs in Android

一曲冷凌霜 提交于 2019-12-04 05:40:21
I am trying to create smaller tabs in android -- but I can't seem to get it to work because all that happens when I create a smaller tab is that it shows the bigger tab -- but without a drawable. This is my layout code for tabs now -- but the height isn't wrapping for some reason -- it just goes to Android's usual layout height. <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout