Posts

Showing posts from September, 2020

Navigation and status bar color

Image
  Code:- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } getWindow().setNavigationBarColor(Color.parseColor("#FFFFFF")); getWindow().setStatusBarColor(Color.parseColor("#FFCDD2"));

Overlay view over another view

Image
  Code: RelativeLayout rl = new RelativeLayout(this); RelativeLayout.LayoutParams lparams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); rl.setLayoutParams(lparams); background.removeAllViews(); rl.addView(view2); rl.addView(view1); background.addView(rl);

Round corner with shadow and ripple effect

Image
  Code1: android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable(); gd.setColor(Color.parseColor(_color)); gd.setCornerRadius((int)_radius); _view.setElevation((int)_shadow); android.content.res.ColorStateList clrb = new android.content.res.ColorStateList(new int[][]{new int[]{}}, new int[]{Color.parseColor("#212121")}); a ndroid.graphics.drawable.RippleDrawable ripdrb = new android.graphics.drawable.RippleDrawable(clrb , gd, null); _view.setClickable(true); _view.setBackground(ripdrb); Code2: android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable(); gd.setColor(Color.parseColor(_color)); gd.setCornerRadius((int)_radius); _view.setBackground(gd); _view.setElevation((int)_shadow);