android Splash Screen & Stretch OverScroll Effect,kotlin
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
class MyAdapter(private val context: Context) : RecyclerView.Adapter<MyVH>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyVH {
val view: View =
LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1, parent, false)
val holder = MyVH(view)
return holder
}
override fun getItemCount(): Int {
return 999
}
override fun onBindViewHolder(holder: MyVH, position: Int) {
holder.text.setText(position.toString())
}
}
class MyVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
var text: TextView
init {
text = itemView.findViewById(android.R.id.text1)
}
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val recyclerView = findViewById<RecyclerView>(R.id.recyclerview)
val linearLayoutManager = LinearLayoutManager(this)
linearLayoutManager.orientation = RecyclerView.VERTICAL
recyclerView.layoutManager = linearLayoutManager
OverScrollDecoratorHelper.setUpOverScroll(
recyclerView,
OverScrollDecoratorHelper.ORIENTATION_VERTICAL
)
val adapter = MyAdapter(this)
recyclerView.adapter = adapter
}
}
(1)Stretch OverScroll Effect, can implements by google's method, or used open source implements:
implementation 'io.github.everythingme:overscroll-decor-android:1.1.1'
(2)splash screen,in this res/values/themes.xml file config:
<!--启动开屏页的背景颜色-->
<item name="android:windowSplashScreenBackground">@android:color/holo_red_light</item>
<!--启动动画的logo-->
<item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<!--启动logo icon的背景颜色-->
<item name="android:windowSplashScreenIconBackgroundColor">@android:color/holo_green_light</item>
<!--品牌-->
<item name="android:windowSplashScreenBrandingImage">@android:drawable/ic_menu_info_details</item>
<!--启动开屏页的显示时长-->
<item name="android:windowSplashScreenAnimationDuration">1000</item>
Android View滚动、拉伸到顶/底部弹性回弹复位_android 页面伸缩弹性_zhangphil的博客-CSDN博客《Android View滚动、拉伸到顶/底部弹性回弹复位》我在上一篇文章介绍了如何实现一个Android ListView拉到顶/底部后,像橡皮筋一样弹性回弹复位(《Android ListView拉到顶/底部,像橡皮筋一样弹性回弹复位》,文章链接地址:http://blog.csdn.net/zhangphil/article/details/47311155 )。事实上,https://blog.csdn.net/zhangphil/article/details/47333845文章来源:https://www.toymoban.com/news/detail-603603.html
Android ListView拉到顶/底部,像橡皮筋一样弹性回弹复位_listview回弹效果_zhangphil的博客-CSDN博客《Android ListView拉到顶/底部,像橡皮筋一样弹性回弹复位》Android本身的ListView拉到顶部或者底部会在顶部/底部边缘间隙出现一道“闪光”效果,暗示ListView已经到顶/底,不能再动了。 这是Android原生的ListView拉到顶部/底部的一种交互设计。交互设计的可选方案很多。Android 5.0将ListView的这个交互设计改变成“一片荡漾的https://blog.csdn.net/zhangphil/article/details/47311155文章来源地址https://www.toymoban.com/news/detail-603603.html
到了这里,关于android Splash Screen & Stretch OverScroll Effect,kotlin的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!