对话框中定义tab布局 AlertDialog Within TabActivity


button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Toast.makeText(context, "dialog", 1).show(); // custom dialog final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialo); dialog.setTitle("Title..."); TabHost tabs = (TabHost) dialog.findViewById(R.id.tabhost); tabs.setup(); TabHost.TabSpec tabpage1 = tabs.newTabSpec("one"); tabpage1.setContent(R.id.tabview1); tabpage1.setIndicator("",getResources().getDrawable(R.drawable.one)); TabHost.TabSpec tabpage2 = tabs.newTabSpec("two"); tabpage2.setContent(R.id.tabview2); tabpage2.setIndicator("",getResources().getDrawable(R.drawable.two)); tabs.addTab(tabpage1); tabs.addTab(tabpage2); dialog.show(); } }); 
dialog.setContentView(R.layout.maintabmenu); TabHost tabs = (TabHost) dialog.findViewById(R.id.my_tabhost); tabs.setup(); tabs.setCurrentTab(0); TabSpec tspec11 = tabs.newTabSpec("Tab1"); tspec11.setIndicator("NEWTAB"); tspec11.setContent(R.id.ScrollView01); tabs.addTab(tspec11); TabSpec tspec2 = tabs.newTabSpec("Tab2"); tspec2.setIndicator("NEWTAB"); tspec2.setContent(R.id.ScrollView02); tabs.addTab(tspec2);

你可能感兴趣的:(对话框中定义tab布局 AlertDialog Within TabActivity)