# InstagramLikeColorTransitionAndroid **Repository Path**: aceyun/InstagramLikeColorTransitionAndroid ## Basic Information - **Project Name**: InstagramLikeColorTransitionAndroid - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-04-20 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # InstagramLikeColorTransition [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-InstagramLikeColorTransition-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5035) How to create instagram like Gradient color transition in android. #### 1. Create some gradient color drawables inside drawable Folder. color1.xml ```xml ``` color2.xml ```xml ``` color3.xml ```xml ``` color4.xml ```xml ``` #### 2. Create animation list using the above created gradient colors, animation_list.xml, inside drawable folder ```xml ``` #### 3. Apply the animation_list created above as a background to the top view of your activity layout. ```xml ``` #### 4. Inside your activity use AnimationDrawable to apply the transition. ```java LinearLayout container = (LinearLayout) findViewById(R.id.container); AnimationDrawable anim = (AnimationDrawable) container.getBackground(); anim.setEnterFadeDuration(6000); anim.setExitFadeDuration(2000); // Starting animation:- start the animation on onResume. @Override protected void onResume() { super.onResume(); if (anim != null && !anim.isRunning()) anim.start(); } // Stopping animation:- stop the animation on onPause. @Override protected void onPause() { super.onPause(); if (anim != null && anim.isRunning()) anim.stop(); } ``` ### Make statusbar transparent values/styles.xml ```xml ``` values-v21/styles.xml ```xml ``` values-v23/styles.xml ```xml ``` ```java public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Add below code if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { findViewById(android.R.id.content).setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); } setContentView(R.layout.activity_splash); } } ``` ```xml ``` # License Copyright 2017 Taishi Yamasaki Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.