/** * 隐藏软键盘 */ fun hideKeyboard(activity: Activity) { val imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager imm.hideSoftInputFromWindow(activity.window.decorView.windowToken, 0) }
// 文字渐隐渐显动画<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:duration="2000" android:fillAfter="true" android:fillBefore="false" android:fromAlpha="1.0" android:interpolator="@android:anim/linear_interpolator" android:repeatMode="reverse" android:repeatCount="-1" android:toAlpha="0.1" /></set>// 代码中应用 private var textAnimation:Animation = AnimationUtils.loadAnimation(requireContext(),R.anim.text_alpha_anim)view.startAnimation(textAnimation)