Android Studio Animation Gradient
Gradientsyellow.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="90"
android:startColor="#6a11cb"
android:endColor="#2575fc"
android:type="linear"/>
</shape>
</item>
</selector>
Android Studio Design Animation
Gradientsbrown.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="90"
android:startColor="#cfd9df"
android:endColor="#e2ebf0"
android:type="linear"/>
</shape>
</item>
</selector>
Android Studio Design Animation
Gradientsgreen.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="90"
android:startColor="#d4fc79"
android:endColor="#96e6a1"
android:type="linear"/>
</shape>
</item>
</selector>
Android Studio Design Animation
Gradientpink.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="90"
android:startColor="#ff9a9e"
android:endColor="#fad0c4"
android:type="linear"/>
</shape>
</item>
</selector>
Android Studio Design Animation
Animationlist.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/gradientsyellow"
android:duration="3000"/>
<item
android:drawable="@drawable/gradientsbrown"
android:duration="3000"/>
<item
android:drawable="@drawable/gradientsgreen"
android:duration="3000"/>
<item
android:drawable="@drawable/gradientspink"
android:duration="3000"/>
</animation-list>
Android Studio Design Animation
Activity_Main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/animationlist"
tools:context=".design3play">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="200dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/textview1"
android:textSize="36sp"
android:textStyle="bold"
tools:text="Hello World" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Android Studio Design Animation
Main_Activity.kt
package com.designapp
import android.graphics.drawable.AnimationDrawable
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.constraintlayout.widget.ConstraintLayout
class design3play : AppCompatActivity() {
lateinit var constraintLayout: ConstraintLayout
lateinit var animationDrawable: AnimationDrawable
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_design3play)
constraintLayout = findViewById(R.id.constraintlayout) as ConstraintLayout
animationDrawable = constraintLayout.background as AnimationDrawable
animationDrawable.setEnterFadeDuration(5000)
animationDrawable.setExitFadeDuration(2000)
}
override fun onResume() {
super.onResume()
if (animationDrawable !=null && !animationDrawable.isRunning){
animationDrawable.start()
}
}
override fun onPause() {
super.onPause()
if (animationDrawable != null && !animationDrawable.isRunning) {
animationDrawable.stop()
}
}
}
0 Response to "Android Studio Animation Gradient"
Post a Comment