List of usage examples for android.widget TextView setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:Main.java
/** * {@link TextView} background color setter. Generally, the caller will * not pass {@link Component#COLOR_DEFAULT}, instead substituting in the * appropriate color./* w w w .j a va2 s.c o m*/ * * @param textview text view instance * @param argb background RGB color with alpha */ public static void setBackgroundColor(TextView textview, int argb) { textview.setBackgroundColor(argb); textview.invalidate(); }
From source file:Main.java
public static void toastGreen(Activity activity, int resId) { Toast toast = Toast.makeText(activity, resId, Toast.LENGTH_LONG); TextView v = (TextView) toast.getView().findViewById(android.R.id.message); v.setBackgroundColor(Color.GREEN); toast.show();/*w w w . j a v a2 s . co m*/ }
From source file:org.jamienicol.resistors.BandAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { TextView view = new TextView(container.getContext()); view.setBackgroundColor(colours[position]); view.setLayoutParams(// w ww .j av a2s. co m new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); container.addView(view); return view; }
From source file:com.jeffreyawest.weblogic.monitor.charting.DefaultPieChart.java
protected final TableRow getRow(final Activity pActivity, int pColor, String pValue) { TableRow row = new TableRow(pActivity); row.setPadding(2, 2, 2, 2);// ww w . j a v a2 s . c o m pActivity.getResources().getDimension(R.dimen.graph_fragment_legend_graphic_size); TextView colorView = new TextView(pActivity); colorView.setBackgroundColor(pColor); colorView .setHeight((int) pActivity.getResources().getDimension(R.dimen.graph_fragment_legend_graphic_size)); colorView.setText(" "); colorView.setWidth((int) pActivity.getResources().getDimension(R.dimen.graph_fragment_legend_graphic_size)); row.addView(colorView); TextView text = new TextView(pActivity); text.setText(pValue); text.setPadding(2, 2, 2, 2); text.setTextSize(15); row.addView(text); return row; }
From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; }/*from w w w.jav a 2 s . c o m*/ final TextView textView = (TextView) inflater.inflate(R.layout.color_fragment, container, false); textView.setBackgroundColor(mColor); textView.setText(mText); return textView; }
From source file:net.saik0.android.examples.nestedpager.ChildFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); int realPosition = getArguments().getInt(REAL_POSITION, -1); int blue = realPosition * 15; TextView text1 = (TextView) view.findViewById(android.R.id.text1); text1.setText(String.format(getActivity().getString(R.string.fragment), realPosition + 1)); text1.setBackgroundColor(Color.argb(255, 0, 0, blue)); }
From source file:org.cvasilak.jboss.mobile.admin.fragments.RuntimeViewFragment.java
private void buildTable() { Map<String, List<String>> table = new HashMap<String, List<String>>(); table.put("Server Status", Arrays.asList("Configuration", "JVM")); table.put("Subsystem Metrics", Arrays.asList("Data Sources", "JMS Destinations", "Transactions", "Web")); if (application.getOperationsManager().isDomainController()) { table.put("Deployments", Arrays.asList("Deployment Content", "Server Groups")); } else {/* w ww.ja va 2 s .co m*/ table.put("Deployments", Arrays.asList("Manage Deployments")); } MergeAdapter adapter = new MergeAdapter(); for (Map.Entry<String, List<String>> entry : table.entrySet()) { // add section header TextView section = new TextView(getActivity()); section.setBackgroundColor(Color.DKGRAY); section.setPadding(15, 10, 0, 10); section.setText(entry.getKey()); adapter.addView(section); // add section data adapter.addAdapter( new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, entry.getValue())); } setListAdapter(adapter); }
From source file:es.usc.citius.servando.calendula.activities.RoutinesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_routines); int color = DB.patients().getActive(this).color(); setupToolbar(null, color);//w w w. j a va 2s .com setupStatusBar(color); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); processIntent(); TextView title = ((TextView) findViewById(R.id.textView2)); title.setBackgroundColor(color); title.setText(getString( mRoutineId != -1 ? R.string.title_edit_routine_activity : R.string.create_routine_button_text)); findViewById(R.id.add_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((RoutineCreateOrEditFragment) getViewPagerFragment(0)).onEdit(); } }); }
From source file:org.cvasilak.jboss.mobile.app.fragments.AttributeEditorFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ActionBar bar = ((ActionBarActivity) getActivity()).getSupportActionBar(); bar.setTitle(attr.getName());//w ww. j a v a 2 s . com MergeAdapter adapter = new MergeAdapter(); // Section: Attributes adapter.addAdapter(new ManagementModelRowAdapter(getActivity(), Arrays.asList(clonedAttr), this)); // Section: Description TextView descrHeader = new TextView(getActivity()); descrHeader.setBackgroundColor(Color.DKGRAY); descrHeader.setPadding(15, 10, 0, 10); descrHeader.setText(R.string.description); adapter.addView(descrHeader); TextView description = new TextView(getActivity()); description.setText(attr.getDescr()); adapter.addView(description); setListAdapter(adapter); }
From source file:it.enricocandino.ssv.sample.ScrollableFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_synchronized_scroll_view, container, false); LinearLayout rowContainer = (LinearLayout) rootView.findViewById(R.id.container); int fragmentColor = getArguments().getInt("color", 0xFFF44336); int count = 1; for (int opacity = 63; opacity < 256; opacity += 16) { TextView row = new TextView(getContext()); row.setLayoutParams(new SynchronizedScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 250)); row.setGravity(Gravity.CENTER);//from w w w. j a v a 2 s . c om row.setBackgroundColor(fragmentColor); row.getBackground().setAlpha(opacity); row.setText(String.valueOf(count++)); rowContainer.addView(row); } return rootView; }