List of usage examples for android.view View setBackgroundResource
@RemotableViewMethod public void setBackgroundResource(@DrawableRes int resid)
From source file:cn.hollo.www.custom_view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setSelected(currentPosition == i); // tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from w w w . j a va 2 s . com } } } }
From source file:com.dudu.duduhelper.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof View) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }// w w w . j av a2s . com } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.newversion.tabstrip.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from www . jav a2 s .co m } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setBackgroundColor(selectedTabTextBackground); } } } }
From source file:com.breadwallet.tools.adapter.TransactionListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup viewGroup) { View tmpLayout = inflater.inflate(R.layout.transaction_list_item, null); if (data.size() == 0 && position == 0) { RelativeLayout noTransactions = (RelativeLayout) inflater.inflate(R.layout.button_no_transactions, null);//from w w w. j a v a 2 s . co m noTransactions.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 70))); return noTransactions; } else if (position == getCount() - (buyBitcoinEnabled ? 5 : 4)) { View separator = new View(activity); separator.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 30))); separator.setBackgroundResource(android.R.color.transparent); return separator; } else if (buyBitcoinEnabled && position == getCount() - 4) { RelativeLayout buyBitcoinLayout = (RelativeLayout) inflater.inflate(R.layout.button_buy_bitcoin, null); buyBitcoinLayout.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 50))); buyBitcoinLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (BRAnimator.checkTheMultipressingAvailability()) { FragmentWebView fragmentWebView = new FragmentWebView(); fragmentWebView.setMode(1); BRAnimator.animateSlideToLeft((MainActivity) activity, fragmentWebView, FragmentSettingsAll.instantiate(activity, FragmentSettingsAll.class.getName())); } } }); return buyBitcoinLayout; } else if (position == getCount() - 3) { RelativeLayout importPrivateKeys = (RelativeLayout) inflater.inflate(R.layout.button_import_privkey, null); importPrivateKeys.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 50))); importPrivateKeys.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (BRAnimator.checkTheMultipressingAvailability()) { BRAnimator.animateDecoderFragment(); } } }); return importPrivateKeys; } else if (position == getCount() - 2) { RelativeLayout settings = (RelativeLayout) inflater.inflate(R.layout.button_settings, null); settings.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 50))); settings.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (BRAnimator.checkTheMultipressingAvailability()) { MainActivity app = MainActivity.app; if (app == null) return; FragmentSettingsAll fragmentSettingsAll = (FragmentSettingsAll) activity .getFragmentManager().findFragmentByTag(FragmentSettingsAll.class.getName()); BRAnimator.animateSlideToLeft(app, new FragmentSettings(), fragmentSettingsAll); } } }); return settings; } else if (position == getCount() - 1) { View separator = new View(activity); separator.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 30))); separator.setBackgroundResource(android.R.color.transparent); separator.setClickable(false); return separator; } if (!BreadWalletApp.unlocked) { if (getUnconfirmedCount(data) == 0 && position == 0) { RelativeLayout txHistory = (RelativeLayout) inflater.inflate(R.layout.button_transaction_history, null); txHistory.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 40))); txHistory.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (BRAnimator.checkTheMultipressingAvailability()) { ((BreadWalletApp) activity.getApplicationContext()).promptForAuthentication(activity, BRConstants.AUTH_FOR_GENERAL, null, null, null, null, false); } } }); return txHistory; } else { if (position == getUnconfirmedCount(data)) { RelativeLayout moreAuth = (RelativeLayout) inflater.inflate(R.layout.button_more, null); moreAuth.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 40))); moreAuth.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (BRAnimator.checkTheMultipressingAvailability()) { ((BreadWalletApp) activity.getApplicationContext()).promptForAuthentication( activity, BRConstants.AUTH_FOR_GENERAL, null, null, null, null, false); } } }); return moreAuth; } else { return getTxView(tmpLayout, position); } } } else { if (showAllTx) return getTxView(tmpLayout, position); if (data.size() > 5) { if (position < 5) { return getTxView(tmpLayout, position); } else { RelativeLayout more = (RelativeLayout) inflater.inflate(R.layout.button_more, null); more.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDps(activity, 40))); more.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showAllTx = true; notifyDataSetChanged(); } }); return more; } } else { return getTxView(tmpLayout, position); } } }
From source file:com.eall.installer.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { final TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); RippleDrawable.For(tab, getResources().getColor(R.color.color_primary)); tab.setTextColor(tabTextColor); tab.setOnTouchListener(new OnTouchListener() { @Override//from w w w. ja v a2 s .co m public boolean onTouch(View v, MotionEvent event) { return false; } }); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { RippleDrawable.For(tab, getResources().getColor(R.color.color_primary_400)); tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.seastar.wasai.views.astuetz.SearchPagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w w w . j a v a2 s . c o m*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); if (i == 0) { tab.setBackgroundResource(R.drawable.shape_search_selected_tab_left); } else if (i == tabCount - 1) { tab.setBackgroundResource(R.drawable.shape_search_selected_tab_right); } else { tab.setBackgroundResource(R.drawable.shape_search_selected_tab_center); } } } } }
From source file:com.xinwei.smallvideo.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w ww .j a va 2 s . co m*/ } } } }
From source file:com.leigo.qsbk.app.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(!tabSwitch ? tabBackgroundResId : transparentColorId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabSwitch && i != 0 ? tabDeactivateTextColor : tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w w w . ja va 2 s.c o m*/ } } else if (v instanceof ImageButton) { ImageButton tab = (ImageButton) v; tab.setSelected(tabSwitch && i == 0 ? true : false); } } }
From source file:com.chj.indicator.lib.TabSlidingIndicator.java
/** * ?/*from w w w .j a va2s . co m*/ */ private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); // TODO: if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (this.pager.getCurrentItem() == i) { // tab.setTextColor(tabSelectedTextColor); } else { // tab.setTextColor(tabNormalTextColor); } // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.bob.googleplay.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // ################??################### // ?item,?? if (pager.getCurrentItem() == i) { // tab.setTextColor(tabSelectedTextColor); } else { // tab.setTextColor(tabNormalTextColor); }//from w w w .j a v a 2 s.c om // ########################################## // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }