android-tabhost

How to pass data between multiple Fragments in Android

筅森魡賤 提交于 2019-12-08 07:33:23
问题 In my main Activity, I have a DialogFragment that contains a FragmentTabHost. I have two tabs, one that is a DialogFragment and one that is a ListFragment. When either the 'OK' button is pressed in the inner DialogFragment or when an element in the ListFragment is pressed, I want to pass two Strings (that are entered in two TextView's in the inner DialogFragment and are displayed in each element in the ListFragment) back to the Activity, but I am unsure of how to do this with multiple levels

Android app keeps crashing with tabhost

冷暖自知 提交于 2019-12-08 07:26:46
问题 My goal is to have two tabs created, each with a different activity. I want the tabs to always be visible at the top so I can easily switch between the two. I believe to have everything set up to create two tabs using tabHost, however the app crashes on start up when I run it. Here is the logcat: Process: com.example.app, PID: 1321 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.TabBar}: java.lang.IllegalStateException: Did you forget to call

Tab host not showing tabs

喜你入骨 提交于 2019-12-08 06:41:02
问题 I am using tab host to show tabs, but even when I simply drag and drop it on my layout, and run it, its not showing the tabs, its showing white screen,I guess which is of the linear layout of first tab view. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabHost android:id="@android:id/tabhost" android:layout_width="match

FragmentTabs creating new Fragment objects every time

不羁岁月 提交于 2019-12-08 06:11:25
问题 I want to use code from : http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html , but I see that it's creating&deleting fragments between every switch. Could you tell me how to change it, so every fragment would be created only once at beginning or after first enter into it? Thanks! P.S. I am using Fragment with TabHost which is used to display one of other Fragments placed inside it. Update: I am getting onCreateView and

Android selector not working in tabhost

淺唱寂寞╮ 提交于 2019-12-08 05:23:14
问题 i have made a simple tabhost demo for learning purpose,i have made it successfully and running it as well,But my problem is images which i have put in drawable should come as mentioned in selectors but its not working..its not even showing images..!my code is: main.java package com.example.tabhostdemo; import android.os.Bundle; import android.app.Activity; import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.view.Menu; import

Set color tab host indicator

亡梦爱人 提交于 2019-12-08 04:57:27
How do you set the color of the tab host indicator color I want to change the light blue default color to lets says RED. And I need to this programatically as I am making the tabs programatically. I did some research and looked at this example but it does not work for me. With the progamtic approach. TabWidget current tab bottom line color Thanks You can do this programmatically, even change the color as you want, by following the solution in the linked question you mention, plus adding a ColorFilter to adjust the color. So: Create the appropriate drawable. The easiest way, as mentioned in one

Common bottom layout in all the tabs of TabHost in Android?

a 夏天 提交于 2019-12-08 03:15:37
问题 I have a TabHost with 4-5 tabs. I want to have a similar bottom for all the tabs. Is there any way we can add a bottom to all the tabs? Or do I need to place the xml code in every layout file. Please let me know if any one has the solution. Regards Sunil 回答1: The simplest solution would be to use the <include> option in your layout files. Define the common footer in a layout file all by itself - e.g tab_footer.xml - and then include it into the the other layouts as follows: <include layout="

Add FragmentTabHost inside fragment

丶灬走出姿态 提交于 2019-12-08 02:56:01
问题 I have an application with a side menu created from fragments. The problem comes when I want to create tabs in one of the fragments. I have tried many examples and not work for me. fragment_home.xml <android.support.v4.app.FragmentTabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"

TabSpec SetContent to Fragment

ぐ巨炮叔叔 提交于 2019-12-07 22:32:58
问题 I am using TabHost inside Fragment to create tabs. The problem I run into is TabSpec's setContent() . I need to set it so that it nests another fragment under the <FrameLayout> . Do I uses getChildFragmentManager() to do this? How do I do so? Xml Layout: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android

Adding AdView below TabHost in XML

ぐ巨炮叔叔 提交于 2019-12-07 21:23:38
问题 I am trying to get an AdView directly below a TabHost. RelativeLayout does allow this to happen with android:layout_alignParentBottom="true" however this overlaps TabHost contents, and does so for the ScrollView's I add inside each Tab (this would probably occur for any views whose height was large enough) Right now the closest I can get to having a TabHost and AdView in their own seperate space on the screen is using this code (below), that allows me to have a Ad directly above the TabHost..