List of usage examples for android.view View setBackgroundResource
@RemotableViewMethod public void setBackgroundResource(@DrawableRes int resid)
From source file:org.egov.android.view.activity.StatusSummaryActivity.java
/** * Function used to show the pictorial representation of the complaint status. * /*from w w w .ja va 2 s . co m*/ * @param status * => registered/forwarded/withdrawn */ private void _drawgraph(String status) { View registered = findViewById(R.id.register); View forwarded_bg = findViewById(R.id.forwarded_bg); View forwarded = findViewById(R.id.forwarded); View closed_bg = findViewById(R.id.close_bg); View closed = findViewById(R.id.closed); if (status.equalsIgnoreCase("registered")) { registered.setBackgroundResource(R.drawable.status_summary_active_circle); } else if (status.equalsIgnoreCase("forwarded")) { registered.setBackgroundResource(R.drawable.status_summary_active_circle); forwarded_bg.setBackgroundColor(getResources().getColor(R.color.orange)); forwarded.setBackgroundResource(R.drawable.status_summary_active_circle); } else if (status.equalsIgnoreCase("withdrawn")) { registered.setBackgroundResource(R.drawable.status_summary_active_circle); forwarded_bg.setBackgroundColor(getResources().getColor(R.color.orange)); forwarded.setBackgroundResource(R.drawable.status_summary_active_circle); closed_bg.setBackgroundColor(getResources().getColor(R.color.orange)); closed.setBackgroundResource(R.drawable.status_summary_active_circle); } }
From source file:com.ubuntuone.android.files.fragment.AutoUploadCustomizeFragment.java
private void bindView(View view, Context context, Cursor cursor) { final int checked = cursor.getInt(cursor.getColumnIndex(WatchedFolders.AUTO_UPLOAD)); mFolderList.setItemChecked(cursor.getPosition(), checked == 1); final int isNew = cursor.getInt(cursor.getColumnIndex(WatchedFolders.IS_NEW)); if (isNew == 1) { view.setBackgroundResource(R.color.soft_orange); } else {//from w w w .j a v a2s.c o m view.setBackgroundResource(android.R.color.background_light); } }
From source file:com.justsmartapps.myvault.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof FlatTextView) { FlatTextView tab = (FlatTextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setBackgroundResource(tabBackgroundResId); tab.setTextColor(textColor); tab.setTypeface(tab.getTypeface(), Typeface.BOLD); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build }/* ww w . j av a 2s. com*/ } }
From source file:de.schildbach.wallet.ui.ExchangeRatesFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.exchange_rates_fragment_empty_text)); adapter = new ResourceCursorAdapter(activity, R.layout.exchange_rate_row, null, true) { @Override/*from ww w. j av a2s . c o m*/ public void bindView(final View view, final Context context, final Cursor cursor) { final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(cursor); final boolean isDefaultCurrency = exchangeRate.currencyCode.equals(defaultCurrency); view.setBackgroundResource(isDefaultCurrency ? R.color.bg_less_bright : R.color.bg_bright); final View defaultView = view.findViewById(R.id.exchange_rate_row_default); defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE); final TextView currencyCodeView = (TextView) view .findViewById(R.id.exchange_rate_row_currency_code); currencyCodeView.setText(exchangeRate.currencyCode); final CurrencyTextView rateView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_rate); rateView.setPrecision(Constants.LOCAL_PRECISION); rateView.setAmount(WalletUtils.localValue(Utils.COIN, exchangeRate.rate)); final CurrencyTextView walletView = (CurrencyTextView) view .findViewById(R.id.exchange_rate_row_balance); walletView.setPrecision(Constants.LOCAL_PRECISION); if (!replaying) { walletView.setAmount(WalletUtils.localValue(balance, exchangeRate.rate)); walletView.setStrikeThru(Constants.TEST); } else { walletView.setText("n/a"); walletView.setStrikeThru(false); } walletView.setTextColor(getResources().getColor(R.color.fg_less_significant)); } }; setListAdapter(adapter); }
From source file:de.schildbach.litecoinwallet.ui.ExchangeRatesFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.exchange_rates_fragment_empty_text)); adapter = new ResourceCursorAdapter(activity, R.layout.exchange_rate_row, null, true) { @Override//ww w . j a va 2s.c om public void bindView(final View view, final Context context, final Cursor cursor) { final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(cursor); final boolean isDefaultCurrency = exchangeRate.currencyCode.equals(defaultCurrency); view.setBackgroundResource(isDefaultCurrency ? R.color.bg_list_selected : R.color.bg_list); final View defaultView = view.findViewById(R.id.exchange_rate_row_default); defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE); final TextView currencyCodeView = (TextView) view .findViewById(R.id.exchange_rate_row_currency_code); currencyCodeView.setText(exchangeRate.currencyCode); final CurrencyTextView rateView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_rate); rateView.setPrecision(Constants.LOCAL_PRECISION, 0); rateView.setAmount(WalletUtils.localValue(Utils.COIN, exchangeRate.rate)); final CurrencyTextView walletView = (CurrencyTextView) view .findViewById(R.id.exchange_rate_row_balance); walletView.setPrecision(Constants.LOCAL_PRECISION, 0); if (!replaying) { walletView.setAmount(WalletUtils.localValue(balance, exchangeRate.rate)); walletView.setStrikeThru(Constants.TEST); } else { walletView.setText("n/a"); walletView.setStrikeThru(false); } walletView.setTextColor(getResources().getColor(R.color.fg_less_significant)); } }; setListAdapter(adapter); }
From source file:com.ijiaban.tabslide.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 w w. j a va2s. co m*/ } } } }
From source file:com.feathercoin.wallet.feathercoin.ui.ExchangeRatesFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.exchange_rates_fragment_empty_text)); adapter = new ResourceCursorAdapter(activity, R.layout.exchange_rate_row, null, true) { @Override/* w ww .j a va 2s .co m*/ public void bindView(final View view, final Context context, final Cursor cursor) { final ExchangeRatesProvider.ExchangeRate exchangeRate = ExchangeRatesProvider .getExchangeRate(cursor); final boolean isDefaultCurrency = exchangeRate.currencyCode.equals(defaultCurrency); view.setBackgroundResource(isDefaultCurrency ? R.color.bg_less_bright : R.color.bg_bright); final View defaultView = view.findViewById(R.id.exchange_rate_row_default); defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE); final TextView currencyCodeView = (TextView) view .findViewById(R.id.exchange_rate_row_currency_code); currencyCodeView.setText(exchangeRate.currencyCode); final CurrencyTextView rateView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_rate); rateView.setPrecision(Constants.LOCAL_PRECISION); rateView.setAmount(WalletUtils.localValue(Utils.COIN, exchangeRate.rate)); final CurrencyTextView walletView = (CurrencyTextView) view .findViewById(R.id.exchange_rate_row_balance); walletView.setPrecision(Constants.LOCAL_PRECISION); walletView.setAmount(WalletUtils.localValue(balance, exchangeRate.rate)); walletView.setStrikeThru(Constants.TEST); walletView.setTextColor(getResources().getColor(R.color.fg_less_significant)); } }; setListAdapter(adapter); loaderManager.initLoader(0, null, this); }
From source file:nf.framework.expand.viewpagerindicator.TabPageIndicator.java
public void setTabViewBackground(int backgroundDrawable) { this.mTabViewBackground = backgroundDrawable; for (int i = 0; i < mTabLayout.getChildCount(); i++) { View childView = mTabLayout.getChildAt(i); if (childView instanceof TabView) { childView.setBackgroundResource(backgroundDrawable); }/*from w w w .j a v a 2s .co m*/ } }
From source file:ar.com.xpasta.Controls.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); if (textAllCaps) tab.setAllCaps(true);//ww w. ja va 2 s . c o m } } }
From source file:com.example.demo_highlights.slidingmenu.fragment.LeftFragment.java
private void initListView() { lvAdapter = new SimpleAdapter(getActivity(), getData(), R.layout.behind_list_show, new String[] { LIST_TEXT, LIST_IMAGEVIEW }, new int[] { R.id.textview_behind_title, R.id.imageview_behind_icon }) { @Override//ww w . j a v a 2 s.c o m public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub. View view = super.getView(position, convertView, parent); if (position == mTag) { view.setBackgroundResource(R.drawable.back_behind_list); lvTitle.setTag(/*view*/String.valueOf(position)); } else { view.setBackgroundColor(Color.TRANSPARENT); } return view; } }; lvTitle.setAdapter(lvAdapter); lvTitle.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // NavigationModel navModel = navs.get(position); // mAboveTitle.setText(navModel.getName()); // current_page = navModel.getTags(); if (mTag != position) { switch (position) { case 0: // imgQuery.setVisibility(View.GONE); new MyTask().execute(new BaseDao()); break; case 1: new MyTask().execute(new BaseDao(getActivity(), 1)); break; case 2: new MyTask().execute(new BaseDao(getActivity(), 2)); break; case 3: new MyTask().execute(new BaseDao(getActivity(), 3)); break; } } if (lvTitle.getTag() != null) { if (lvTitle.getTag().equals(String.valueOf(position))) { // MainActivity.this.showContent(); view.setBackgroundResource(R.drawable.back_behind_list); mTag = position; return; } else { /* ((View) lvTitle.getTag()) .setBackgroundColor(Color.TRANSPARENT);*/ mTag = position; lvTitle.setTag(/*view*/String.valueOf(position)); view.setBackgroundResource(R.drawable.back_behind_list); } } else { mTag = position; lvTitle.setTag(view); view.setBackgroundResource(R.drawable.back_behind_list); } // imgQuery.setVisibility(View.VISIBLE); lvAdapter.notifyDataSetChanged(); } }); }