The graphical layout for a simple android.support.v4.app.FragmentTabHost never renders in either Eclipse or Android Studio.
The Console error I get is consistently:
Exception raised during rendering: No tab known for tag null
I'm using the most basic XML file:
<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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
but the same error occurs.
I just wanted to add more views above or below the tab widget and frame layout.
I don't care so much about seeing the tab content; I just want to see the rest of my layout - but the problem is that NO OTHER VIEWS are rendered when a android.support.v4.app.FragmentTabHost
resides in the layout.
I've read and tried to resolve the issue from the answer to this post:
Android: Tabs at the bottom with FragmentTabHost
but I don't think that that is my problem; I'm not looking to put a TabWidget on the bottom.
Every other one of my XML files opens perfectly.
The same problem occurs in Android Studio:
From Layout i am getting the same Error..so,I resolve that Problem by Code only...It's working fine..Please try this code
I had the same rendering problem as well as compilation error. I fixed the problem by finding that I was not passing Fragment when i was creating Addtab. You must pass atleast one fragment on mTabHost.addTab. Below is the working code.
Not sure about the error you've got (sorry, I'm really busy right now so can't spend more time checking) but in general it seems that the
FragmentTabHost
from the support libs doesn't care about the xml at all. See my previous answer to another question:FragmentTabHost with horizontal scroll
If U need to put fragmented tabs at bottom of screen ... @fallow undermentioned --
Make your xml file like this ..
Now if your concern is opening several fragments with in single fragmented tabs ...
@follow steps ::
For ex:- Just like you replace your bed with different bed sheets .. :)
Your container fragment class that will be used differently in different tabs ... "LearnContainerFragment.java "
LearnContainerFragment.java --- > it's xml file container_fragment.xml
@ How to use Conatiner..
@last your BaseContainerFragment.java class --
Hope it helps..... Cheers!
not sure.... but shouldn't your layout have a tabhost tag in it above the tabwidget's linear layout?
i made an app a while back that implented tabs using tabhost and this is how my layout was...one tab had a calendar view one had an image switcher and one had a listview...sorry i can't be of more help