Android: Is it possible to create both Bottom and Top tabs on the screen? -


i know if possible have different tabs on top , bottom lead different activities when clicked. googled didnt find it.

thanks

the thing android want should possible. if alter xml change like:

<?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@android:id/tabhost"     android:layout_width="fill_parent"     android:layout_height="fill_parent" >  <linearlayout     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >      <tabwidget         android:id="@android:id/tabs_top"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="0" />      <framelayout         android:id="@android:id/tabcontent"         android:layout_width="fill_parent"         android:layout_height="0dip"         android:layout_weight="1" />      <tabwidget         android:id="@android:id/tabs_bottom"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="0" /> </linearlayout>  </tabhost> 

notice i've changed id's of tabwidgets.

this half of problem. other half how source code core class tabhost should altered accommodate change.

you can review source of original tabhost here. looking @ source it's pretty obvious code has single mtabwidget , initialized using specific id = tabs (com.android.internal.r.id.tabs). we've changed id's should mindful of this.

so, how can alter original source? 1 approach make our own class , extend core tabhost. not easy because half of functions , members inside original tabhost private (why aren't protected?!?). anyways, since have source code , it's pretty simple, it's possible it.

let's new extended class mytabhost (potentially place in same package original tabhost can access variables/functions have no private or public), can replace in xml word tabhost mytabhost or com.yourpackage.mytabhost actually) , class used in xml instead of original.

from looking @ source code, it's obvious feature isn't supported default. - think if want make happen, can see way.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -