android - java.lang.IllegalStateException: No tab known for tag null for FragmentTabHost -
i getting error while rendering xml file. has fragmenttabhost, tabwidget vertical scrollview , framelayout displaying tab's content. , ya using vertical tabs on horizontal.
below layout file
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background2" android:orientation="vertical"> <include android:id="@+id/toolbar" layout="@layout/toolbar" /> <android.support.v4.app.fragmenttabhost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightsum="1"> <scrollview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.3"> <tabwidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" /> </scrollview> <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="0dp" android:layout_height="match_parent" android:layout_weight="0.7" /> </linearlayout> </android.support.v4.app.fragmenttabhost> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="@dimen/standard_height" android:orientation="horizontal" android:weightsum="1"> <com.custom.fontbutton android:id="@+id/btn_clear" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.3" android:background="@color/toolbar" android:minheight="@dimen/standard_height" android:text="clear" android:textcolor="@color/background" android:textsize="@dimen/font_18" app:customfont="@string/font_regular" /> <com.custom.fontbutton android:id="@+id/btn_apply" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.7" android:background="@color/button" android:elevation="5dp" android:minheight="@dimen/standard_height" android:text="apply" android:textcolor="@color/background" android:textsize="@dimen/font_18" app:customfont="@string/font_regular" /> </linearlayout> </linearlayout>
and error throwing while rendering -
java.lang.illegalstateexception: no tab known tag null @ android.support.v4.app.fragmenttabhost.dotabchanged(fragmenttabhost.java:330) @ android.support.v4.app.fragmenttabhost.onattachedtowindow(fragmenttabhost.java:280) @ android.view.view.dispatchattachedtowindow(view.java:14514) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2836) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2843) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2843) @ android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2843) @ android.view.attachinfo_accessor.setattachinfo(attachinfo_accessor.java:42) @ com.android.layoutlib.bridge.impl.rendersessionimpl.inflate(rendersessionimpl.java:232) @ com.android.layoutlib.bridge.bridge.createsession(bridge.java:426) @ com.android.ide.common.rendering.layoutlibrary.createsession(layoutlibrary.java:350) @ com.android.tools.idea.rendering.rendertask$2.compute(rendertask.java:510) @ com.android.tools.idea.rendering.rendertask$2.compute(rendertask.java:498) @ com.intellij.openapi.application.impl.applicationimpl.runreadaction(applicationimpl.java:888) @ com.android.tools.idea.rendering.rendertask.createrendersession(rendertask.java:498) @ com.android.tools.idea.rendering.rendertask.access$600(rendertask.java:72) @ com.android.tools.idea.rendering.rendertask$3.call(rendertask.java:610) @ com.android.tools.idea.rendering.rendertask$3.call(rendertask.java:607) @ com.android.tools.idea.rendering.renderservice.runrenderaction(renderservice.java:366) @ com.android.tools.idea.rendering.rendertask.render(rendertask.java:607) @ com.android.tools.idea.rendering.rendertask.render(rendertask.java:629) @ com.intellij.android.designer.designsurface.androiddesignereditorpanel$6.run(androiddesignereditorpanel.java:480) @ com.intellij.util.ui.update.mergingupdatequeue.execute(mergingupdatequeue.java:320) @ com.intellij.util.ui.update.mergingupdatequeue.execute(mergingupdatequeue.java:310) @ com.intellij.util.ui.update.mergingupdatequeue$2.run(mergingupdatequeue.java:254) @ com.intellij.util.ui.update.mergingupdatequeue.flush(mergingupdatequeue.java:269) @ com.intellij.util.ui.update.mergingupdatequeue.flush(mergingupdatequeue.java:227) @ com.intellij.util.ui.update.mergingupdatequeue.run(mergingupdatequeue.java:217) @ com.intellij.util.concurrency.queueprocessor.runsafely(queueprocessor.java:238) @ com.intellij.util.alarm$request$1.run(alarm.java:351) @ java.util.concurrent.executors$runnableadapter.call(executors.java:439) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303) @ java.util.concurrent.futuretask.run(futuretask.java:138) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:895) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:918) @ java.lang.thread.run(thread.java:695)
ps: have read other post, none of them working, please don't mark duplicate.
edit: solution found
the problem fragmenttabhost
default orientation set tabwidget.horizontal
, cannot modified via xml, why illegalstateexception
occurred vertical
scrolls. overcome in fragment
or activity
class need set orientation manually. check out snippet setting orientation
tabwidget.setorientation(tabwidget.vertical);
once done done error!
Comments
Post a Comment