Display a contextmenu when clicking a tab, in the same screen with the tabs

天涯浪子 提交于 2019-12-13 03:58:44

问题


I need to display something like a context menu when a certain tab is pressed, something like this :

Is it possible? I know that when a tab is declared it must be set an Intent, and I want to display this context menu in the same screen with the tabs (the same activity). Need some help. Any idea is welcome. Thanks in advance.

EDIT : I want to say that the last tab to be something like this :

on Facebook. The last tab to have some options but the content to not be modified.


回答1:


As according to your reqiurement as u only want contex menu at Tab not other data for that tab than u there is no need to add intent type for that tab or comment that intent for that tab example like

// intent = new Intent().setClass(this, tabactivity3.class);
 spec = tabHost.newTabSpec("songs").setIndicator("Search",
                       res.getDrawable(R.drawable.act3))
                   .setContent(intent);

     tabHost.addTab(spec);

i have commented intent for tab 3 which will show context menu on behind view as previous tab data as shown image below where my ic_launcher image display is of tab 1



来源:https://stackoverflow.com/questions/11204729/display-a-contextmenu-when-clicking-a-tab-in-the-same-screen-with-the-tabs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!