Gradient effect in android tutorial
Step 1 : Go to Theme Setting change App Theme to NoActionbar.
Theme.AppCompat.Light.NoActionBar |
Step 2 : Create a Tollbar
android:id=
"@+id/toolbar"
android:layout_height=
"56dp"
android:background=
"@color/black"
android:layout_width=
"match_parent"
/>
Step 3 :
private
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
toolbar.setTitle("abc");
toolbar.setTitleTextColor(getResources().getColor(R.color.white));
setSupportActionBar(toolbar);
Step 4 :
android:shape = "rectangle" > < gradient android:angle = "270" android:endColor = "#0000" android:startColor = "@color/black" /> </ shape > |
Step 5 : back to your toolbar , adding background .
<
android.support.v7.widget.Toolbar
android:id
=
"@+id/toolbar"
android:layout_height
=
"56dp"
android:background
=
"@drawable/blackgradient"
android:layout_width
=
"match_parent"
/>
That's it .Happy Coding.
No comments: