优化UI
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.example.defenseapplication.login
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import com.example.defenseapplication.R
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
@@ -22,6 +24,11 @@ class LoginActivity : AppCompatActivity() {
|
||||
binding = ActivityLoginBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
// 设置渐变背景
|
||||
val startColor = Color.parseColor("#CBEBFA")
|
||||
val endColor = Color.parseColor("#FFF2EF")
|
||||
setGradientBackground(binding.main, startColor, endColor)
|
||||
|
||||
setupTabListeners()
|
||||
setupClickListeners()
|
||||
switchToSmsMode()
|
||||
@@ -159,4 +166,15 @@ class LoginActivity : AppCompatActivity() {
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun setGradientBackground(
|
||||
view: android.view.View,
|
||||
startColor: Int,
|
||||
endColor: Int,
|
||||
orientation: GradientDrawable.Orientation = GradientDrawable.Orientation.TL_BR
|
||||
) {
|
||||
val gradientDrawable = GradientDrawable(orientation, intArrayOf(startColor, endColor))
|
||||
gradientDrawable.gradientType = GradientDrawable.LINEAR_GRADIENT
|
||||
view.background = gradientDrawable
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user