当前位置: 首页 > news >正文

网站备案前置审批类型大访问量的网站怎么做优化

网站备案前置审批类型,大访问量的网站怎么做优化,西安seo优化,注册网站域名的入口文章目录 Android 扩大View的点击区域使用padding属性使用TouchDelegate使用getLocationOnScreen监听 Android 扩大View的点击区域 使用padding属性 通过设置 padding 属性扩大点击区域。 使用#xff1a; ?xml version1.0 encodingutf-8? ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:apphttp://schemas.android.com/apk/res-autoxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:gravitycenter_horizontalandroid:orientationverticalTextViewandroid:idid/text1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:padding20dpandroid:texthello /TextViewandroid:idid/text2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:padding40dpandroid:textworld //LinearLayout使用TouchDelegate TouchDelegate 类是 Android 中的一个辅助类可以用于扩展 View 的触摸区域如小按钮。 目标View必须有父 View。给多个 View 扩大点击区域时不能是同一个父 View从 View 类的源码中可知设置 setTouchDelegate 时会覆盖之前的。 扩展类 fun View.expandTouchView(expandSize: Int 15.dp) {val parentView parent as? ViewparentView?.post {val rect Rect()getHitRect(rect)Log.e(TAG, rect $rect)rect.left - expandSizerect.top - expandSizerect.right expandSizerect.bottom expandSizeLog.e(TAG, expandRect $rect)parentView.touchDelegate TouchDelegate(rect, this)} }使用 val text1 findViewByIdTextView(R.id.text1) val text2 findViewByIdTextView(R.id.text2)text1.run {expandTouchView()setOnClickListener {ToastUtils.show((it as TextView).text.toString())} }text2.run {expandTouchView(40.dp)setOnClickListener {ToastUtils.show((it as TextView).text.toString())} }使用getLocationOnScreen监听 使用 getLocationOnScreen() 可以获取目标 View 在屏幕中的坐标。RectF 是一个用于表示浮点坐标的矩形区域的类可以用于设置扩大区域。通过监听 onTouchEvent() 触摸方法获取触摸的坐标然后判断是否在扩大区域内。 自定义View class ParentTouchView JvmOverloads constructor(context: Context, attrs: AttributeSet? null, defStyleAttr: Int 0 ) : LinearLayout(context, attrs, defStyleAttr) {private lateinit var text1: TextViewoverride fun onFinishInflate() {super.onFinishInflate()if (childCount 0) {text1 findViewById(R.id.text1)text1.setOnClickListener {ToastUtils.show(text1.text.toString())}}}override fun onTouchEvent(event: MotionEvent?): Boolean {event?.let { e -if (e.action MotionEvent.ACTION_DOWN) {if (isExpandView(text1, e.rawX, e.rawY, 100.dp)) {text1.performClick()}}}return super.onTouchEvent(event)}/*** 是否在View的扩大区域** param targetView 目标View* param touchX 点击的位置* param touchY 点击的位置* param expandSize 扩大区域的大小* return*/private fun isExpandView(targetView: View,touchX: Float,touchY: Float,expandSize: Int 15.dp): Boolean {// 获取目标View的Rectval rect RectF()val location IntArray(2)// 获取目标View的坐标targetView.getLocationOnScreen(location)val childX location[0].toFloat()val childY location[1].toFloat()rect.set(childX,childY,childX targetView.width,childY targetView.height)// 设置扩大区域后的Rectrect.apply {left - expandSizetop - expandSizeright expandSizebottom expandSize}// 判断是否在扩大区域内return rect.contains(touchX, touchY)} }使用 ?xml version1.0 encodingutf-8? com.example.xxx.view.ParentTouchView xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:apphttp://schemas.android.com/apk/res-autoxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:gravitycenterandroid:orientationverticaltools:context.clickarea.LocationOnScreenActivityTextViewandroid:idid/text1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:texthello //com.example.xxx.view.ParentTouchView
http://www.w-s-a.com/news/75457/

相关文章:

  • 商城网站建设源码嘉兴seo计费管理
  • 城乡建设网站证件查询系统wordpress 时间代码
  • php网站建设 关键技术做网站哪家正规
  • 网站开发用什么写得比较好谷歌的英文网站
  • 青岛网站建设公司在哪vivo手机商城
  • 兼职刷客在哪个网站做哪个网站做淘宝客
  • 眼科医院网站开发网络营销特点是什么
  • 提交网站给百度增加wordpress插件
  • 网站建设企业官网体验版是什么Wordpress哪个模板最快
  • 美丽说网站模板湖北可以做网站方案的公司
  • 北京西站进站最新规定建设网站的提成是多少
  • wordpress站点如何加速网站建设描述怎么写
  • 如何免费建造网站免费vi模板网站
  • 商丘做网站多少钱扬州大发网站建设
  • 网站建设哪家性价比高自己做项目的网站
  • 成立一个网站济宁营销型网站建设
  • 南通购物网站建设设计类平台网站
  • 专业网站建设咨询thinkphp网站源码下载
  • 怎么制作一个国外网站网站推广找哪家公司好
  • 免费做网站怎么做网站想在网上卖东西怎么注册
  • 淘宝网站建设的策划书网投怎么做网站
  • 如何免费做公司网站视频网站开发视频
  • 网站后台是怎么更新wordpress 大于2m的xm
  • 制作网页设计软件列表案例营销网站优化seo
  • 住房和建设建设局网站报告长官夫人在捉鬼
  • 用asp做网站需要什么软件天津建设工程信息网怎么注册
  • 一站式服务图片北京网站优化多少钱
  • 专业的论坛网站建设全网加速器
  • 成都品牌建设网站公司表单制作小程序
  • 手机端 网站 模板网页广告关不掉怎么办