List of usage examples for android.view View setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:nf.frex.android.FrexActivity.java
static void setMenuBackground(final Activity activity) { activity.getLayoutInflater().setFactory(new LayoutInflater.Factory() { @Override/*from w ww . j a v a 2 s . c o m*/ public View onCreateView(String name, Context context, AttributeSet attrs) { if (name.equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView")) { try { LayoutInflater inflater = activity.getLayoutInflater(); final View view = inflater.createView(name, null, attrs); new Handler().post(new Runnable() { public void run() { view.setBackgroundColor(Color.argb(127, 0, 0, 0)); } }); return view; } catch (InflateException e) { // :( } catch (ClassNotFoundException e) { // :( } } return null; } }); }
From source file:org.catrobat.catroid.pocketmusic.ui.PianoView.java
public PianoView(Context context, AttributeSet attributeSet) { super(context, attributeSet); margin = getResources().getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); for (int i = 0; i < WHITE_KEY_COUNT; i++) { View whiteButton = new View(context); whiteButton.setBackgroundColor(ContextCompat.getColor(context, R.color.white)); whitePianoKeys.add(whiteButton); addView(whiteButton);/*w w w . j ava2 s . co m*/ } for (int i = 0; i < BLACK_KEY_COUNT; i++) { View blackButton = new View(context); blackButton.setBackgroundColor(ContextCompat.getColor(context, R.color.solid_black)); blackPianoKeys.add(blackButton); addView(blackButton); } currentHeight = 0; }
From source file:android.support.test.testapp.SimplePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); View view = inflater.inflate(R.layout.pager_view, null); ((TextView) view.findViewById(R.id.pager_content)).setText("Position #" + position); view.setBackgroundColor(COLORS[position]); container.addView(view);//from ww w . ja va2 s .c om return view; }
From source file:com.vv.androidreview.ui.activites.PermissionsActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent() == null || !getIntent().hasExtra(EXTRA_PERMISSIONS)) { throw new RuntimeException("PermissionsActivity???startActivityForResult?!"); }/* w w w .j a v a 2 s.co m*/ View view = new View(this); view.setBackgroundColor(getResources().getColor(R.color.theme_color_level2)); ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); view.setLayoutParams(lp); setContentView(view); mChecker = new PermissionsChecker(this); isRequireCheck = true; }
From source file:org.deviceconnect.android.uiapp.fragment.profile.NotificationProfileFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { inflater, container, savedInstanceState }); View view = inflater.inflate(R.layout.fragment_notification_service, container, false); view.setBackgroundColor(getResources().getColor(android.R.color.background_light)); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.notification_type_list, android.R.layout.simple_spinner_item); mSpinner = (Spinner) view.findViewById(R.id.fragment_notification_service_type); mSpinner.setAdapter(adapter);/*from www. j a va2 s . com*/ Button sendButton = (Button) view.findViewById(R.id.fragment_notification_service_send); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { onClickSend(view); } }); mLogger.exiting(getClass().getName(), "onCreateView", view); return view; }
From source file:org.deviceconnect.android.uiapp.fragment.profile.SystemProfileFragment.java
@Override public View onCreateView(final LayoutInflater paramLayoutInflater, final ViewGroup paramViewGroup, final Bundle paramBundle) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { paramLayoutInflater, paramViewGroup, paramBundle }); View view = super.onCreateView(paramLayoutInflater, paramViewGroup, paramBundle); view.setBackgroundColor(getResources().getColor(android.R.color.background_light)); mLogger.exiting(getClass().getName(), "onCreateView", view); return view;//from ww w. j a v a2 s .co m }
From source file:org.deviceconnect.android.uiapp.fragment.profile.BatteryProfileFragment.java
@Override public View onCreateView(final LayoutInflater paramLayoutInflater, final ViewGroup paramViewGroup, final Bundle paramBundle) { View view = super.onCreateView(paramLayoutInflater, paramViewGroup, paramBundle); view.setBackgroundColor(getResources().getColor(android.R.color.background_light)); return view;//from w w w.j a v a2 s.c om }
From source file:com.roiland.crm.sm.ui.view.SmContacterInfoFragment.java
public void displayContacterInfo() { if (contacterInfoAdapter == null) return;/*from w w w. ja v a 2 s. co m*/ contacterInfoAdapter.addView("?", (contacter != null ? contacter.getContName() : null)); contacterInfoAdapter.addView("?", (contacter != null ? contacter.getContMobile() : null)); contacterInfoAdapter.addView("?", (contacter != null ? (contacter.getContOtherPhone() != null ? contacter.getContOtherPhone().trim() : null) : null)); contacterInfoAdapter.addView("?", (contacter != null ? contacter.getIsPrimContanter() : null)); contacterInfoAdapter.addView("", (contacter != null ? contacter.getContGender() : null)); contacterInfoAdapter.addView("", (contacter != null ? StringUtils.isEmpty(contacter.getContBirthday()) ? "" : DateFormatUtils.formatDate(contacter.getContBirthday()) : null)); contacterInfoAdapter.addView("???", (contacter != null ? contacter.getIdNumber() : null)); contacterInfoAdapter.addView("", (contacter != null ? contacter.getAgeScope() : null)); contacterInfoAdapter.addView("?", (contacter != null ? contacter.getContType() : null)); contacterInfoAdapter.addView("", (contacter != null ? contacter.getContRelation() : null)); contacterInfoAdapter.addView("?", ((contacter != null && contacter.getLicenseValid() != null) ? DateFormatUtils.formatDate(contacter.getLicenseValid()) : null)); View dividerView = new View(getActivity()); dividerView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 1)); dividerView.setBackgroundColor(getResources().getColor(R.color.list_divider)); contacterInfoList.addView(dividerView); }
From source file:com.laer.easycast.MusicPane.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = new View(getActivity()); root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.setBackgroundColor(Color.WHITE); root = inflater.inflate(R.layout.imagepane, container, false); setHasOptionsMenu(true);//from www. ja v a2s . co m myViewGroup = container; return root; }
From source file:com.granita.tasks.groupings.BaseTaskViewDescriptor.java
protected void setColorBar(View view, Cursor cursor) { View colorbar = getView(view, R.id.colorbar); if (colorbar != null) { colorbar.setBackgroundColor(TaskFieldAdapters.LIST_COLOR.get(cursor)); }//from ww w.j a v a 2 s .c o m }