List of usage examples for android.widget TabWidget getTabCount
public int getTabCount()
From source file:org.eyeseetea.malariacare.DashboardActivity.java
private void addTagToLastTab(String tabName) { TabWidget tabWidget = tabHost.getTabWidget(); int numTabs = tabWidget.getTabCount(); ViewGroup tabIndicator = (ViewGroup) tabWidget.getChildTabViewAt(numTabs - 1); ImageView imageView = (ImageView) tabIndicator.getChildAt(0); imageView.setTag(tabName);// w w w . j ava 2 s . c o m TextView textView = (TextView) tabIndicator.getChildAt(1); textView.setGravity(Gravity.CENTER); textView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; textView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT; }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static boolean updateButtonBar(Activity a, int highlight) { final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar); boolean withtabs = false; Intent intent = a.getIntent();/*ww w .j av a2 s . co m*/ if (intent != null) { withtabs = intent.getBooleanExtra("withtabs", false); } if (highlight == 0 || !withtabs) { ll.setVisibility(View.GONE); return withtabs; } else if (withtabs) { ll.setVisibility(View.VISIBLE); } for (int i = ll.getChildCount() - 1; i >= 0; i--) { View v = ll.getChildAt(i); boolean isActive = (v.getId() == highlight); if (isActive) { ll.setCurrentTab(i); sActiveTabIndex = i; } v.setTag(i); v.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { for (int i = 0; i < ll.getTabCount(); i++) { if (ll.getChildTabViewAt(i) == v) { ll.setCurrentTab(i); processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId()); break; } } } } }); v.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId()); } }); } return withtabs; }