List of usage examples for android.view View setBackgroundResource
@RemotableViewMethod public void setBackgroundResource(@DrawableRes int resid)
From source file:com.xxjwd.libs.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { v.setPadding(0, 0, 0, 0);//from ww w . j av a 2 s . c o m } else { v.setPadding(tabPadding, 0, tabPadding, 0); } 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 source file:com.collcloud.frame.viewpager.PagerSlidingTabStrip.java
public void updateTabStyles(int curPosition) { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof RelativeLayout) { RelativeLayout rL = (RelativeLayout) v; TextView tab = (TextView) rL.getChildAt(0); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (curPosition == i) { tab.setTextColor(pstsTextHighLightColor); } else { tab.setTextColor(tabTextColor); }/* w ww .j av a 2 s . co m*/ // 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:es.usc.citius.servando.calendula.fragments.MedicineCreateOrEditFragment.java
private void selectPresentation(Presentation p) { for (View v : getViewsByTag((ViewGroup) getView(), "med_type")) { v.setBackgroundColor(getResources().getColor(R.color.transparent)); }/*w w w .j a v a 2 s .c o m*/ if (p != null) { int viewId = getPresentationViewId(p); View view = getView().findViewById(viewId); view.setBackgroundResource(R.drawable.presentation_circle_background); mPresentationTv.setText(p.getName(getResources())); scrollToMedPresentation(view); } }
From source file:com.lillicoder.demo.carouselview.DemoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo); CarouselView carousel = (CarouselView) findViewById(R.id.carousel); carousel.setAdapter(new CarouselView.Adapter<Pair<String, Integer>>(getCarouselItems()) { @Override/*from www .j a v a2 s . c o m*/ public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public void onDestroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public Object onInstantiateItem(ViewGroup container, int position) { Pair<String, Integer> pair = getItem(position); final LayoutInflater inflater = LayoutInflater.from(container.getContext()); TextView view = (TextView) inflater.inflate(R.layout.view_carousel_item, container, false); view.setBackgroundResource(pair.second); view.setText(pair.first); container.addView(view); return view; } }); }
From source file:midian.baselib.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); if (i == pager.getCurrentItem()) { tab.setTextColor(tabSelectColor); if (isShowRigthIcon) { addRightIcon(tab, i, true); }//from ww w. jav a2s . co m } else { tab.setTextColor(tabTextColor); if (isShowRigthIcon) { addRightIcon(tab, i, 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)); // } // } } } }
From source file:org.mareatlantica.ui.Views.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { v.setPadding(0, 0, 0, 0);//from www . j a v a2 s .co m v.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 1.0F)); } else { v.setPadding(tabPadding, 0, tabPadding, 0); } 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 source file:cn.com.incito.driver.UI.detailDialog.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { v.setPadding(0, 0, 0, 0);/*w w w. j av a 2 s . c om*/ } else { v.setPadding(tabPadding, 0, tabPadding, 0); } 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 source file:com.hua.weget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); selectedTabTextColor = context.getResources().getColor(R.color.homefragment_top_title_color); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); tab.setCompoundDrawablesWithIntrinsicBounds(context.getResources().getDrawable(mDrawableIds[i]), null, null, null);//from ww w . ja v a 2 s. c o m // 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) { tab.setTextColor(selectedTabTextColor); tab.setCompoundDrawablesWithIntrinsicBounds( context.getResources().getDrawable(mDrawableIdsSleect[i]), null, null, null); } } } }
From source file:com.yibairun.ui.components.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { RelativeLayout tabLayout = (RelativeLayout) tabsContainer.getChildAt(i); View v = tabLayout.getChildAt(0); 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 . jav a 2 s.c o m } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.nadmm.airports.aeronav.ChartsDownloadFragment.java
protected void onChartCount(Context context, Intent intent) { String tppVolume = intent.getStringExtra(AeroNavService.TPP_VOLUME); int avail = intent.getIntExtra(AeroNavService.PDF_COUNT, 0); View row = mVolumeRowMap.get(tppVolume); if (row != null) { row.setOnClickListener(mOnClickListener); int background = UiUtils.getSelectableItemBackgroundResource(getActivity()); row.setBackgroundResource(background); row.setTag(R.id.DTPP_CHART_AVAIL, avail); int total = (Integer) row.getTag(R.id.DTPP_CHART_TOTAL); showStatus(row, avail, total);//from w w w.ja va 2 s .c o m } }