android-tabhost

How to Implement Android tab menu without deprecated tabhost

痞子三分冷 提交于 2019-12-05 13:26:24
My question sounds simple, but I can't seem to find a sufficient answer for this. I'm trying to design an app for tablets that has some information at the top quarter of the screen, and then a tabbed menu for information below the top quarter. Basically what I'm looking for is : ┌───────────────────────────────────── │ │ Top of Page │ ├───────┬───────┬───────┬───────┬───── │ Tab 1 │ Tab 2 │ Tab 3 │ Tab 4 │ │ └───────┴───────┴───────┴───── │ │ Bottom of page │ │ │ ⁞ I was originally going to use a tabhost with multiple tabs; but I realize that it's deprecated now, and so I'm looking for the

findFragmentByTag - looking for fragment in FragmentTabHost - always null

三世轮回 提交于 2019-12-05 11:31:33
I'm having trouble getting a pointer to a Fragment which is the currently visible fragment in a FragmentTabhost. I have a SherlockFragmentActivity called SecondActivity that loads the Tabhost from it's onCreate method like this: if (getSupportFragmentManager().findFragmentById(android.R.id.content) == null) { Fragment f = new TabsFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, f, "tabsfragment").commit(); } TabsFragment is a SherlockFragment subclass with this onCreate method to create the tabs @Override public View onCreateView(LayoutInflater inflater,

TabHost - how to change tab text in XML

无人久伴 提交于 2019-12-05 02:53:14
I know the solution on how to change it programically however I would like to set the text in XML. How do you do that? I have looked here: http://developer.android.com/reference/android/widget/TabHost.html but found no solution. How about .... <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal

Problem Showing ProgressDialog within Nested Tab Activity

邮差的信 提交于 2019-12-05 02:49:42
问题 I am Having Nested Tab Activity. TabMain (TabHost) with that i have ChildTab (another TabHost) and other 2 Activities. I can able to show Progress Dialog in that other 2 activity. But with in ChildTab TabActivity I add 5 Activities in that i can able to Show progressDialog. I am getting the following error. ERROR/AndroidRuntime(339): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@43d304f0 is not valid

Switching between fragmentTabs giving unexpected results

ε祈祈猫儿з 提交于 2019-12-05 01:38:09
问题 I am trying to implement FragmentTabs as illiustrated in http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html. Everything went well until i did this: I started lots of different fragments from one tab like: tab1-->fragment1--->fragment2--->fragment3 tab2 But when i switched to tab2 and again came back to tab1, I got fragment1 screen not fragment3(i.e. I have 3 fragments in first tab and while i am on 3rd fragment and I come again

How to set Android toolbar height?

我们两清 提交于 2019-12-05 01:27:16
I want to achieve this: What I thought was to make a Custom Toolbar with a bigger height and work with the tabhost and tabpager normally. I have implemented it, but the toolbar is showing the normal height, so it doesn't show as I want, just the top part. Is this the right approach or is it possible to set a TabHost below a Linear/Relative Layout? Because I don't need to work with it as an action bar. Relevant Code toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbarTitle"

Android Inflating Views of Tab View

泄露秘密 提交于 2019-12-04 21:16:28
I want to implement this feature in my app as shown below. Activity with Action bar and Action Items Tabs Below the actionbar Each of the Tabs will have content. I used Tab fragments and TabListeners to code. Now when i run the app i am getting tab view but the view pager and indicator are missing. i am getting an activity as shown below. My code is as shown below. TabViewActivity .java public class TabViewActivity extends SherlockFragmentActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); copyPrivateRawResuorceToPubliclyAccessibleFile(); ActionBar

Android - creating a Generic TabHost, passing info using Bundle problem

两盒软妹~` 提交于 2019-12-04 21:16:22
I've got a project in which I'm trying to do some refactoring of my existing TabHosts. I've got a bunch of very simple TabHost files that look like the class below. Some actually only have one tab, some 3, etc - so the only real difference in them is the number of tabs and the activity class loaded in each one. I'd like to just create a single TabHost that could get the info out of a passed in Bundle to determine how many tabs and the info needed (spec, indicator, content) to build/add each tab. It seems like the items I can place in the bundle are pretty basic and I'm not familiar with the

Android TabHost inside LinearLayout

断了今生、忘了曾经 提交于 2019-12-04 20:46:05
Hey... i'm trying to create an activity with the layout structure like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TabHost android:id="@+id/tabHost" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TabWidget android:layout_width="fill_parent" android:layout_height="wrap_content

How to add images as a tab indicator in android tab host?

落爺英雄遲暮 提交于 2019-12-04 19:46:01
I am currently developing an application which a tab host is shown, each one of tab in the tab host is an activity. Now, what I want to do is to replace my text tab indicator as an image. These are the code that I used for implementing my tab host activity. TabHostActivity: public class TabHostActivity extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tabhost); TabHost tabHost = (TabHost) findViewById (android.R.id.tabhost); TabSpec tab1 = tabHost.newTabSpec("First Tab"); TabSpec tab2 =