Android Studio Kotlin Alert UI Animation
build gradle project
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
Android Studio Kotlin
build gradle module
implementation 'com.tapadoo.android:alerter:3.0.0'
Main_Activity.kt
package com.designapp
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.tapadoo.alerter.Alerter
class design14part15 : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_design14part15)
}
public fun buyBitcoin(view: View) {
Alerter.create(this)
.setTitle("Buy Bitcoin")
.setText("Are you sure to buy now?")
.addButton("BUY", R.style.AlertButton, View.OnClickListener {
Alerter.create(this)
.setTitle("Success")
.setText("you just paid $10.000")
.setBackgroundColorInt(Color.parseColor("#1abc9c"))
.setTextAppearance(Color.parseColor("#34495e"))
.show()
})
.setBackgroundColorInt(Color.parseColor("#e74c3c"))
.show()
}
}
Android Studio Kotlin
Activity_Main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/gradientsgreen"
tools:context=".design14part15">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/bitcoin"
android:contentDescription="@string/todo" />
<Button
android:id="@+id/Bitcoin"
android:layout_marginTop="20dp"
android:layout_width="159dp"
android:layout_height="82dp"
android:layout_gravity="center"
android:onClick="buyBitcoin"
android:text="@string/buybitcoin"
android:textSize="18sp" />
</LinearLayout>
</ScrollView>
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
Android Studio Kotlin
build gradle module
implementation 'com.tapadoo.android:alerter:3.0.0'
Main_Activity.kt
package com.designapp
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.tapadoo.alerter.Alerter
class design14part15 : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_design14part15)
}
public fun buyBitcoin(view: View) {
Alerter.create(this)
.setTitle("Buy Bitcoin")
.setText("Are you sure to buy now?")
.addButton("BUY", R.style.AlertButton, View.OnClickListener {
Alerter.create(this)
.setTitle("Success")
.setText("you just paid $10.000")
.setBackgroundColorInt(Color.parseColor("#1abc9c"))
.setTextAppearance(Color.parseColor("#34495e"))
.show()
})
.setBackgroundColorInt(Color.parseColor("#e74c3c"))
.show()
}
}
Android Studio Kotlin
Activity_Main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/gradientsgreen"
tools:context=".design14part15">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/bitcoin"
android:contentDescription="@string/todo" />
<Button
android:id="@+id/Bitcoin"
android:layout_marginTop="20dp"
android:layout_width="159dp"
android:layout_height="82dp"
android:layout_gravity="center"
android:onClick="buyBitcoin"
android:text="@string/buybitcoin"
android:textSize="18sp" />
</LinearLayout>
</ScrollView>
0 Response to "Android Studio Kotlin Alert UI Animation"
Post a Comment