The status bar in the layout is also gradient, I just tried to adjust the monotonous color - it does not fit, and the designer does not like it.

They offered to use dark gray, but suddenly you can.

So is it possible to implement similar functionality in android?

Ps. No more pictures could be found, but I hope everything is visible here.

  • 2
    possible solution on enSO stackoverflow.com/a/36907967/5634351 - Kirill Stoianov
  • @KirillStoianov yes, there really is a good option - but with the replacement of the toolbar with your markup, as far as I understand? Are there any other ways to do this, because the main icon is a hamburger, and replace the toolbars everywhere with something completely merciless. - Silento
  • And if you do the same thing with the usual tollbar? - Kirill Stoianov
  • @KirillStoianov really did not think. Issue as an answer. - Silento

1 answer 1

You can make a gradient bar status by setting a semi-transparent for it.

@Override protected void onCreate(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } 

create a drawable with gradient and set it as background in the toolbar

gradient_drawable.xml

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="135" android:startColor="#f56f2c" android:endColor="#fa9f46"/> </shape>