Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taishi-y/instagramlikecolortransitionandroid
How to create instagram like Gradient color transition in android.πΈ
https://github.com/taishi-y/instagramlikecolortransitionandroid
android animation gradient-color-transition instagram transition
Last synced: 3 days ago
JSON representation
How to create instagram like Gradient color transition in android.πΈ
- Host: GitHub
- URL: https://github.com/taishi-y/instagramlikecolortransitionandroid
- Owner: Taishi-Y
- License: mit
- Created: 2017-01-06T13:01:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-16T08:02:27.000Z (over 4 years ago)
- Last Synced: 2025-01-02T00:06:49.132Z (10 days ago)
- Topics: android, animation, gradient-color-transition, instagram, transition
- Language: Java
- Homepage:
- Size: 14.2 MB
- Stars: 601
- Watchers: 13
- Forks: 71
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# InstagramLikeColorTransition
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-InstagramLikeColorTransition-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5035)
[δΈζη](https://github.com/Taishi-Y/InstagramLikeColorTransitionAndroid/blob/master/README_cn.md) by [zhaoweih](https://github.com/zhaoweih)
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-v19/styles.xml
```xml
<item name="android:windowTranslucentStatus">true</item>
```values-v21/styles.xml
```xml
<item name="android:statusBarColor">@android:color/transparent</item>
```values-v23/styles.xml
```xml
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
``````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
```