当前位置: 首页>>代码示例>>Java>>正文


Java OnTabChangeListener类代码示例

本文整理汇总了Java中android.widget.TabHost.OnTabChangeListener的典型用法代码示例。如果您正苦于以下问题:Java OnTabChangeListener类的具体用法?Java OnTabChangeListener怎么用?Java OnTabChangeListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnTabChangeListener类属于android.widget.TabHost包,在下文中一共展示了OnTabChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initView

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
private void initView() {
    mAddItem = (LinearLayout) findViewById(R.id.main_add_item);
    mTabHost = (FragmentTabHost) findViewById(R.id.main_tabhost);
    mTabHost.setup(this, getSupportFragmentManager(), R.id.main_container);
    mTabHost.setBackgroundColor(getResources().getColor(R.color.bg_tabhost));
    mTabHost.getTabWidget().setDividerDrawable(null);
    mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (tabId.equals(BlackListFragmet.NAME)) {
                mActionBar.setTitle("黑名单", LocalActionBar.MIDDLE_TITLE);
        //        mAddItem.setVisibility(View.VISIBLE);
            } else {
                mActionBar.setTitle("添加", LocalActionBar.MIDDLE_TITLE);
        //        mAddItem.setVisibility(View.GONE);
            }
        }
    });
    addTabItem(BlackListFragmet.NAME, "黑名单", BlackListFragmet.TAB_ICON, BlackListFragmet.class);
    addTabItem(AddDataFragment.NAME, "添加", AddDataFragment.TAB_ICON, AddDataFragment.class);
}
 
开发者ID:facetome,项目名称:Interceptor,代码行数:22,代码来源:MainActivity.java

示例2: initTabHost

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
private void initTabHost() {

        final TabHost mTabHost = (TabHost) findViewById(android.R.id.tabhost);

        mTabHost.addTab(createTabSpec(mTabHost, R.string.tab_password1, R.id.tab_password,
                "password1"));
        mTabHost.addTab(createTabSpec(mTabHost, R.string.tab_password2, R.id.tab_password,
                "password2"));        
        mTabHost.addTab(createTabSpec(mTabHost, R.string.tab_pin, R.id.tab_pin, "pin"));
        mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
			
			@Override
			public void onTabChanged(String tabId) {
				if ("password1".equals(tabId)) {
					hash = profiles[0];
					generateIfValid();
				} else if ("password2".equals(tabId)) {
					hash = profiles[1];
					generateIfValid();
				}
			}
		});
    }
 
开发者ID:pdudits,项目名称:supergenpass-android,代码行数:24,代码来源:Super_Gen_Pass.java

示例3: FileGalleryPreviewDialog

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
public FileGalleryPreviewDialog(Context context) {
	super(context);
	
	View dialogView = getLayoutInflater().inflate(R.layout.label_dialog, null);
	setView(dialogView);
	
	setButton(DialogInterface.BUTTON_POSITIVE, getContext().getResources().getString(R.string.confirm_dialog_button),
			new OnClickListener() {
				
				@Override
				public void onClick(DialogInterface dialog, int which) {
					// do nothing
				}
			});
	
	tabHost = (TabHost) dialogView.findViewById(R.id.label_tabhost);
	tabHost.setup();
	
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		
		@Override
		public void onTabChanged(String tabId) {
			// Hide/show video preview so it's not visible in background on tab change
			if ("video_preview".equals(tabId)) {
				videoView.setVisibility(View.VISIBLE);
				videoView.start();
			} else {
				if (videoView != null) {
					videoView.setVisibility(View.GONE);
				}
			}
		}
	});
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:35,代码来源:FileGalleryPreviewDialog.java

示例4: LabelDialog

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
@SuppressLint("InflateParams")
public LabelDialog(Context context) {
	super(context);
	
	tabs = new ArrayList<String>();
	tabSpecs = new ArrayList<TabHost.TabSpec>();
	
	setButton(DialogInterface.BUTTON_NEGATIVE, getContext().getResources().getString(R.string.cancel_dialog_button),
			new OnClickListener() {
		
		@Override
		public void onClick(DialogInterface dialog, int which) {
			// User cancelled the dialog
		}
	});

	View labelDialogView = getLayoutInflater().inflate(R.layout.label_dialog, null);
	setView(labelDialogView);
	
	tabHost = (TabHost) labelDialogView.findViewById(R.id.label_tabhost);
	tabHost.setup();
	// Hide soft keyboard on tab change
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		
		@Override
		public void onTabChanged(String tabId) {
			handleTabChange(tabId);
		}
	});
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:31,代码来源:LabelDialog.java

示例5: init

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
private void init() {
	tabhost = this.getTabHost();

	first = tabhost.newTabSpec("first");
	second = tabhost.newTabSpec("second");		
	
	// ָ��ѡ������֣�ͼ��
	first.setIndicator(createContent("���", R.drawable.first_tab));
	second.setIndicator(createContent("����", R.drawable.two_tab));
	
	// ����ʾ��ҳ��
	first.setContent(new Intent(this, InspectionActivity.class));
	second.setContent(new Intent(this, SettingActivity.class));
	
	// ��ѡ��ӽ�TabHost
	tabhost.addTab(first);
	tabhost.addTab(second);
	//�趨��ǰTab
	tabhost.setCurrentTab(0);
	// ����tabHost�л�ʱ��̬����ͼ��
	tabhost.setOnTabChangedListener(new OnTabChangeListener() {

		@Override
		public void onTabChanged(String tabId) {
			tabChanged(tabId);
		}

	});
	
}
 
开发者ID:donghaoli,项目名称:EquitmentInspection,代码行数:31,代码来源:MainActivity.java

示例6: initialiseTabHost

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
/**
 * Initializes the tabhost and updates the viewpager when tab changed.
 */
private void initialiseTabHost() {
	_tabhost = (TabHost) findViewById(android.R.id.tabhost);
	_tabhost.setup();
	_tabhost.setOnTabChangedListener(new OnTabChangeListener() {

		@SuppressLint("NewApi")
		@Override
		public void onTabChanged(String tabId) {
			int pos = _tabhost.getCurrentTab();
			if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.HONEYCOMB)
			{
				switch(pos)
				{
				case 0:
					EasyTracker.getInstance(ctx).send(MapBuilder.createEvent("ui_action", "tab_change", "authority_info_tab", null).build());
					getActionBar().setTitle("Authority Info");
					invalidateOptionsMenu();
					previousBackCount = backCount;
					backCount = 0;
					break;
				case 1:
					EasyTracker.getInstance(ctx).send(MapBuilder.createEvent("ui_action", "tab_change", "user_info_tab", null).build());
					getActionBar().setTitle("User Info");
					invalidateOptionsMenu();
					backCount = previousBackCount;
				}
			}
			_pager.setCurrentItem(pos);
		}
	});
}
 
开发者ID:liarosge,项目名称:apps4thess,代码行数:35,代码来源:AlertsActivity.java

示例7: initTabs

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
private void initTabs()
{
    mTabHost = (TabHost)mView.findViewById(android.R.id.tabhost);
    mTabHost.setup();
    
    final TabSpec spec1 = mTabHost.newTabSpec(TAB_TAG_RGB);
    spec1.setContent(R.id.color_edit_view_tab_rgb);
    spec1.setIndicator(getString(R.string.color_edit_tab_rgb));
    
    final TabSpec spec2 = mTabHost.newTabSpec(TAB_TAG_RGB);
    spec2.setContent(R.id.color_edit_view_tab_hsv);
    spec2.setIndicator(getString(R.string.color_edit_tab_hsv));
    
    mTabHost.addTab(spec1);
    mTabHost.addTab(spec2);
    
    mTabHost.setOnTabChangedListener(new OnTabChangeListener(){
        @Override
        public void onTabChanged(String tabId)
        {
            updateColor();
            
            if (mCallback != null)
                mCallback.onTabChanged(ColorEditView.this, 
                                       mTabHost.getCurrentTab(), 
                                       mTabHost.getCurrentTabTag());
        }
    });
}
 
开发者ID:TianziHou,项目名称:tzPalette,代码行数:30,代码来源:ColorEditView.java

示例8: onCreate

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
protected void onCreate(Bundle paramBundle) {
		super.onCreate(paramBundle);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_tab);
		tabHost=this.getTabHost();

		
        //添加选项卡
		tabHost.addTab(tabHost.newTabSpec("TAB_GPS").setIndicator("TAB_GPS")
        			.setContent(new Intent(this, ui.activity.gps.GpsObtainActivity.class)));
		tabHost.addTab(tabHost.newTabSpec("TAB_MAP").setIndicator("TAB_MAP")
        		.setContent(new Intent(this,ui.activity.GoogleMap.GMapActivity.class)));
		tabHost.addTab(tabHost.newTabSpec("TAB_WEATHER").setIndicator("TAB_WEATHER")
        		.setContent(new Intent(this,ui.activity.weather.WeatherActivity.class))); 
//		tabHost.addTab(tabHost.newTabSpec("TAB_COMMUNITY").setIndicator("TAB_COMMUNITY")
//        		.setContent(new Intent(this,ui.activity.community.CommunityActivity.class))); 
//		tabHost.addTab(tabHost.newTabSpec("TAB_COMMUNITY").setIndicator("TAB_COMMUNITY")
//        		.setContent(new Intent(this,ui.activity.community.Communitymain.class))); 
		
        radioderGroup = (RadioGroup) findViewById(R.id.main_radio);
		radioderGroup.setOnCheckedChangeListener(this);

		this.tabHost.setOnTabChangedListener(new OnTabChangeListener() {

			@Override
			public void onTabChanged(String tabId) {
				// TODO Auto-generated method stub
			}
		});
	}
 
开发者ID:Tifosi-M,项目名称:Hi-Top,代码行数:31,代码来源:MainActivity.java

示例9: setOnTabChangedListener

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
public void setOnTabChangedListener(OnTabChangeListener l) {
    this.mOnTabChangeListener = l;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:FragmentTabHost.java

示例10: setOnTabChangedListener

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
public void setOnTabChangedListener(OnTabChangeListener onTabChangeListener) {
    this.f78e = onTabChangeListener;
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:4,代码来源:FragmentTabHost.java

示例11: onCreate

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	if (Controller.getInstance().getPreferences()
			.getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
	}

	if (Controller
			.getInstance()
			.getPreferences()
			.getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}

	setContentView(R.layout.bookmarks_history_activity);

	setTitle(R.string.BookmarksListActivity_Title);

	Resources res = getResources();
	TabHost tabHost = getTabHost();
	TabHost.TabSpec spec;
	Intent intent;

	// Bookmarks
	intent = new Intent().setClass(this, BookmarksListActivity.class);

	spec = tabHost
			.newTabSpec("bookmarks")
			.setIndicator(res.getString(R.string.Main_MenuShowBookmarks),
					res.getDrawable(R.drawable.ic_tab_bookmarks))
			.setContent(intent);
	tabHost.addTab(spec);

	// History
	intent = new Intent().setClass(this, HistoryListActivity.class);

	spec = tabHost
			.newTabSpec("history")
			.setIndicator(res.getString(R.string.Main_MenuShowHistory),
					res.getDrawable(R.drawable.ic_tab_history))
			.setContent(intent);
	tabHost.addTab(spec);

	if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
			Constants.PREFERENCE_USE_WEAVE, false)) {
		// Weave bookmarks
		intent = new Intent().setClass(this,
				WeaveBookmarksListActivity.class);

		spec = tabHost
				.newTabSpec("weave")
				.setIndicator(
						res.getString(R.string.WeaveBookmarksListActivity_Title),
						res.getDrawable(R.drawable.ic_tab_weave))
				.setContent(intent);
		tabHost.addTab(spec);
	}

	tabHost.setCurrentTab(0);

	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		@Override
		public void onTabChanged(String tabId) {
			if (tabId.equals("bookmarks")) {
				setTitle(R.string.BookmarksListActivity_Title);
			} else if (tabId.equals("history")) {
				setTitle(R.string.HistoryListActivity_Title);
			} else if (tabId.equals("weave")) {
				setTitle(R.string.WeaveBookmarksListActivity_Title);
			} else {
				setTitle(R.string.ApplicationName);
			}
		}
	});
}
 
开发者ID:tommy4711,项目名称:gaeproxy,代码行数:79,代码来源:BookmarksHistoryActivity.java

示例12: init

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
@AfterViews
public void init() {
       mFragmentManager = getActivity().getSupportFragmentManager();
       mTabHost.setup(getActivity(), mFragmentManager, R.id.realtabcontent);

       mTabHost.addTab(createSpec(Constants.TAB_SEATCH_HOUSE, getString(R.string.main_tab_search_house)), GeneratedClassUtils.get(SearchHouseFragment.class), null);
       mTabHost.addTab(createSpec(Constants.TAB_POST, getString(R.string.main_tab_post)), GeneratedClassUtils.get(ReleaseFragment.class), null);
       mTabHost.addTab(createSpec(Constants.TAB_MINE, getString(R.string.main_tab_mine)), GeneratedClassUtils.get(MineFragment.class), null);

       mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
           @Override
           public void onTabChanged(String tabId) {
               View searchHouseView = mTabHost.getTabWidget().getChildTabViewAt(0);
               View postView = mTabHost.getTabWidget().getChildTabViewAt(1);
               View mineView = mTabHost.getTabWidget().getChildTabViewAt(2);
               TextView searchTextView = (TextView) searchHouseView.findViewById(R.id.main_tab_item);
               TextView postTextView = (TextView) postView.findViewById(R.id.main_tab_item);
               TextView mineTextView = (TextView) mineView.findViewById(R.id.main_tab_item);
               if (tabId.equals(Constants.TAB_SEATCH_HOUSE)) {
                   searchTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_search_pre, 0, 0, 0);
                   searchTextView.setTextColor(Color.parseColor(Constants.SLECTED_TEXT_COLOR));
                   postTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_post_org, 0, 0, 0);
                   postTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   mineTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_agent_org, 0, 0, 0);
                   mineTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
               } else if (tabId.equals(Constants.TAB_POST)) {
                   searchTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_search_org, 0, 0, 0);
                   searchTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   postTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_post_pre, 0, 0, 0);
                   postTextView.setTextColor(Color.parseColor(Constants.SLECTED_TEXT_COLOR));
                   mineTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_agent_org, 0, 0, 0);
                   mineTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
               } else if (tabId.equals(Constants.TAB_MINE)) {
                   searchTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_search_org, 0, 0, 0);
                   searchTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   postTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_post_org, 0, 0, 0);
                   postTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   mineTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_agent_pre, 0, 0, 0);
                   mineTextView.setTextColor(Color.parseColor(Constants.SLECTED_TEXT_COLOR));
               }
           }
       });

       mTabHost.getTabWidget().setDividerDrawable(null);

       mTabHost.setCurrentTab(1);
   }
 
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:48,代码来源:MainFragment.java

示例13: onCreate

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
       //requestWindowFeature(Window.FEATURE_NO_TITLE);
      // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
	setContentView(R.layout.activity_main);
	ViewUtils.inject(this);
	context = this;
	ActionBar actionBar = getActionBar();
       actionBar.setTitle("护眼精灵");
       listview = (ListView) findViewById(R.id.listviewApp);
       listview =new ListView(this);
       // tvInfo = (TextView)findViewById(R.id.tvInfo) ;
       mlistAppInfo = new ArrayList<RunningAppInfo>();
       listInfo =new ArrayList<RunningAppInfo>();
       pieView = (PieView) this.findViewById(R.id.lotteryView);
       pieView=new PieView(this,0);
       myButton=(MyButton)this.findViewById(R.id.MyBt);
      // myButton=new MyButton(this);
       textView=(TextView)this.findViewById(R.id.MyTV);
      // textView =new TextView(this);
       //initView();
       Intent intent = getIntent();
       int pid = intent.getIntExtra("EXTRA_PROCESS_ID", -1);
       //注册广播,监听后台Service发送过来的广播
       receiver = new UITimeReceiver();
       IntentFilter filter = new IntentFilter(TIME_CHANGED_ACTION);
       this.registerReceiver(receiver, filter);
       //启动服务,时间改变后发送广播,通知UI层修改时间
       startTimeService();
	// --------------------
	tabHost = (TabHost) findViewById(android.R.id.tabhost);
	tabHost.setup();
	tabHost.addTab(tabHost.newTabSpec("0").setIndicator(createTab("健康评估", 0)).setContent(android.R.id.tabcontent));
       tabHost.addTab(tabHost.newTabSpec("1").setIndicator(createTab("使用统计", 1)).setContent(android.R.id.tabcontent));
	tabHost.addTab(tabHost.newTabSpec("2").setIndicator(createTab("设置", 2)).setContent(android.R.id.tabcontent));
	// 点击tabHost 来切换不同的消息
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		@Override
		public void onTabChanged(String tabId) {
			int index = Integer.parseInt(tabId);
			setTabSelectedState(index, 3);
			tabHost.getTabContentView().setVisibility(View.GONE);// 隐藏content
		}
	});

       tabHost.setCurrentTab(0);
	initJazzyPager(TransitionEffect.Standard);



   }
 
开发者ID:ZhuFengdaaa,项目名称:Chuangxinbei,代码行数:53,代码来源:MainActivity1.java

示例14: onCreate

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.main);

	FragmentTabHost tabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
	tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
	//1
	tabHost.addTab(tabHost.newTabSpec("Apple")
		   				  .setIndicator("Apple"), 
  					  AppleFragment.class, 
  					  null);
    //2
	tabHost.addTab(tabHost.newTabSpec("Google")
			   			  .setIndicator("Google"), 
				  GoogleFragment.class, 
				  null);
    //3
	tabHost.addTab(tabHost.newTabSpec("Facebook")
			   			  .setIndicator("Facebook"), 
				  FacebookFragment.class, 
			      null);
	
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		
		@Override
		public void onTabChanged(String tabId) {
			
		}
	});
	
	back = (View) findViewById(R.id.navi_back);
       back.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			finish();
			
		}
	});
}
 
开发者ID:givemepassxd999,项目名称:dialogdemo,代码行数:43,代码来源:FragmentTabActivity.java

示例15: onCreate

import android.widget.TabHost.OnTabChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {		
	super.onCreate(savedInstanceState);
	
	if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {        	
       	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
       }
       
       if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
       	requestWindowFeature(Window.FEATURE_NO_TITLE);
       }
	
	setContentView(R.layout.bookmarks_history_activity);
	
	setTitle(R.string.BookmarksListActivity_Title);
	
	Resources res = getResources();
	TabHost tabHost = getTabHost();
	TabHost.TabSpec spec;
	Intent intent;
	
	// Bookmarks
	intent = new Intent().setClass(this, BookmarksListActivity.class);
	
	spec = tabHost.newTabSpec("bookmarks").setIndicator(res.getString(R.string.Main_MenuShowBookmarks),
               res.getDrawable(R.drawable.ic_tab_bookmarks))
               .setContent(intent);
	tabHost.addTab(spec);
	
	// History
	intent = new Intent().setClass(this, HistoryListActivity.class);

	spec = tabHost.newTabSpec("history").setIndicator(res.getString(R.string.Main_MenuShowHistory),
               res.getDrawable(R.drawable.ic_tab_history))
               .setContent(intent);
	tabHost.addTab(spec);

	if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Constants.PREFERENCE_USE_WEAVE, false)) {
		// Weave bookmarks
		intent = new Intent().setClass(this, WeaveBookmarksListActivity.class);

		spec = tabHost.newTabSpec("weave").setIndicator(res.getString(R.string.WeaveBookmarksListActivity_Title),
				res.getDrawable(R.drawable.ic_tab_weave))
				.setContent(intent);
		tabHost.addTab(spec);
	}
	
	tabHost.setCurrentTab(0);
	
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {			
		@Override
		public void onTabChanged(String tabId) {
			if (tabId.equals("bookmarks")) {
				setTitle(R.string.BookmarksListActivity_Title);
			} else if (tabId.equals("history")) {
				setTitle(R.string.HistoryListActivity_Title);
			} else if (tabId.equals("weave")) {
				setTitle(R.string.WeaveBookmarksListActivity_Title);
			} else {
				setTitle(R.string.ApplicationName);
			}
		}
	});
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:65,代码来源:BookmarksHistoryActivity.java


注:本文中的android.widget.TabHost.OnTabChangeListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。