CheckedTextView
替代LineaLayout + TextView + ImageView
构造单选项Chronometer
替代RxJava.interval + TextView
StackView
类似Android的多任务的布局QuickContactBadge
图片,点击会自动链接通讯录Space
代替margin,因为onDraw()
方法为空,所以不会渲染,包括事件处理都无效TextClock
时间显示ToggleButton
配合android:button="@drawable/sel"
可以实现Switch
效果//去除右下角小三角图标 quickContactBadge.assignContactFromPhone("13012345678", false) val f = quickContactBadge::class.java.getDeclaredField("mOverlay") f.isAccessible = true f.set(quickContactBadge, null)
TextSwitcher
替代ViewFlipper
实现滚动条效果textSwitcher.setFactory { val tv = TextView(this@MainActivity) tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f) tv.setTextColor(Color.RED) return@setFactory tv } textSwitcher.inAnimation = AnimationUtils.loadAnimation(this, R.anim.anim_in); textSwitcher.outAnimation = AnimationUtils.loadAnimation(this, R.anim.anim_out); Observable.interval(1000L, 3000L, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe { textSwitcher.setText((Random().nextInt()).toString()) }
anim_in:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" android:shareInterpolator="false" android:zAdjustment="top"> <translate android:duration="3000" android:fromYDelta="100%p" android:toYDelta="0"/> </set>
anim_out:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" android:shareInterpolator="false" android:zAdjustment="top"> <translate android:duration="3000" android:fromYDelta="0" android:toYDelta="-100%p"/> </set>
PopupMenu
类似QQ的右上角”+”效果
Android新组件应用
猜你喜欢
转载自blog.csdn.net/riqthen/article/details/81947552
周排行