android-tabhost

Android TabHost tabs steal focus when using Hardware Keyboard

扶醉桌前 提交于 2019-12-03 11:33:13
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 stolen from the EditText and given to the currently active tab in the TabHost . This only occurs on screens with tabs. Is there a quick and simple way to solve this? This has been a known bug for quite a long time: http://code.google.com/p/android/issues/detail?id=2516 A workaround would be forcing the TabHost to lose focus after a tab is selected. This

Vertical tabs in Android

穿精又带淫゛_ 提交于 2019-12-03 10:53:23
I want to make vertical tabs in Android like below image. I had see example for vertical tabs from below link. Click here In this link answer has some comments and in comments they had share code but the link of mega-upload is expired. I had try many ways but not able to display tabs vertical. When I am trying according to link the tabs can not be display. Please help me When I use tabs, I normally just hide the tabwidget tag by setting android visibility as gone. And add buttons to act as the tab buttons like THIS IS MODIFIED TO MAKE VERTICAL TAB BUTTONS <?xml version="1.0" encoding="utf-8"?>

How to launch an activity with a specific tab?

不想你离开。 提交于 2019-12-03 09:03:48
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 case he is being redirected from another activity. My TabHost code (MyTabActivity): int tabIndex = 0;

Is there a way to display fragments in TabHost?

心已入冬 提交于 2019-12-03 08:28:09
I'd like to show a different fragment in a TabHost, for every tab. But it seems that there's no easy way to do this. TabHost can only accept A. Views or B. Intents that launch Activities when the user selects a tab. Going with A means that I have to initialize every fragment and load them into container Views that are given to the TabHost. But I want these fragments to load only when needed - when the user selects their tab that is. Going with B means that I load the fragments into separate Activities for each tab. But I'd like the fragment to be able to reach the "original" parent Activity,

MapActivity in TabHost Fragment disappearing after tab switch

徘徊边缘 提交于 2019-12-03 08:03:55
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 it to display a MapActivity. MapFragment does use LocalActivityManager to propogate lifecycle events

Getting reference to nested fragment from FragmentTabHost

匆匆过客 提交于 2019-12-03 06:00:54
In my application, I use an Activity which holds one Fragment with FragmentTabHost and hence all its tabs are nested Fragments . Inside an Activity which holds a Fragment with its nested Fragment , we may get a reference to attached one using onAttachedFragment() . But how to get a reference to nested Fragment from FragmentTabHost ? Well, exploring the source code of FragmentTabHost I've found that when it adds a fragment tab, it assignes a tag of TabSpec to nested Fragment . So to get the reference to this Fragment we should call getChildFragmentManager().findFragmentByTag(tabSpecTag)

How to create app bar with icons using TabLayout Android Design?

筅森魡賤 提交于 2019-12-03 03:49:34
问题 I'm trying to use the new TabLayout in the android design library to create app bar with icons. public void setupTabLayout(TabLayout tabLayout) { tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER); tabLayout.setupWithViewPager(mViewpager); tabLayout.getTabAt(0).setIcon(R.drawable.ic_tabbar_library); tabLayout.getTabAt(1).setIcon(R.drawable.ic_tabbar_recents); tabLayout.getTabAt(2).setIcon(R.drawable.ic_tabbar_favorites); tabLayout.getTabAt(3)

Tab with icon using TabLayout in Android Design Library

房东的猫 提交于 2019-12-03 03:38:20
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 only. i'm trying to avoid using it. because i didn't get the tint color for the icon like this image above. i try to write like this: tabLayout.addTab(tabLayout.newTab().setIcon(R.drawable.ic_dashboard)) but the icon still stay in the same color when i select the tab you have to create a selector for the icon. For example: <?xml version="1.0"

Tab content disappeared after change page

徘徊边缘 提交于 2019-12-03 03:33:49
I have a weird issue with my Tab (TabHost or TabContent) in my Fragment that contains a ViewPager. The problem is that when I change the page, then I turn back to the fragment with tab and viewPager, my content or view disappeared. -> Here's my code for TabFragment package com.halo.mobi.fragment; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4

Android Activity call another Activity method

喜夏-厌秋 提交于 2019-12-02 20:46:55
问题 A TabActivity start other activity when i click on a tab, How to send information to parent (tabActivity) and don't finish current activity? My tabactivity start another activity like this : mTabHost.addTab( mTabHost.newTabSpec(TAB_OPTIONS) .setIndicator(TabImgFond5) .setContent(intentOptions)); Inside my new Activity Option, i would like to Call method of Tabactivity, is it possible ? Thanks 回答1: Call getParent() from the tab's activity to get at the TabActivity . 来源: https://stackoverflow