Android how make tabhost's tab behaves as a button -


i'd creat tabhost's tab behaves button display dialog

here current code:

public class mainactivity extends fragmentactivity {          private fragmenttabhost mtabhost;           @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.tabhost);              mtabhost = (fragmenttabhost)findviewbyid(android.r.id.tabhost);             mtabhost.setup(this, getsupportfragmentmanager(), r.id.realtabcontent);              mtabhost.addtab(mtabhost             .newtabspec("critères")             .setindicator(layoutinflater.from(this).inflate(r.layout.button_tabs_bg, null)),             mydialogfragment.class, null);              mtabhost.addtab(mtabhost             .newtabspec("map")             .setindicator("map"),             mymapfragment.class, null);         }    } 

as can see set tab's content button not expect for. juste want normal tab display dialog without selected.

do have ideas how proceed ?

thanks in advance! :)

you can add on tab changed listener tabhost

mtabhost.setontabchangedlistener(new tabhost.ontabchangelistener() {     @override         public void ontabchanged(string tabid) {             // build dialog , show         }     } }); 

according additional request. have options:

  1. extend tabhost class , override setcurrenttab method - way may stop execution of new fragment.
  2. add onclick / outouch listener each tab seperate , stop on unwanted one: https://stackoverflow.com/a/10192064/503127

Comments