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

专业商城网站搭建费用seo搜索引擎优化报价

专业商城网站搭建费用,seo搜索引擎优化报价,友链网站降权,安平县外贸网站建设一、无障碍功能简介 首先我们先来了解下无障碍功能的官方介绍#xff1a; 无障碍服务仅应用于帮助残障用户使用 Android 设备和应用。它们在后台运行#xff0c;并在触发 AccessibilityEvents 时接收系统的回调。此类事件表示用户界面中的某些状态转换#xff0c;例如焦点已…一、无障碍功能简介 首先我们先来了解下无障碍功能的官方介绍 无障碍服务仅应用于帮助残障用户使用 Android 设备和应用。它们在后台运行并在触发 AccessibilityEvents 时接收系统的回调。此类事件表示用户界面中的某些状态转换例如焦点已更改、按钮已被点击等。此类服务可以选择性地请求查询活动窗口内容的功能。开发无障碍服务需要扩展此类并实现其抽象方法。 从以上介绍我们得知可以通过这个系统服务添加全局的活动窗口并对窗口状态做监听。那么我们今天就借助系统的无障碍服务来实现的设备全局水印效果具体的需求内容是添加一个全局的文字透明层同时确保不抢占页面焦点并允许用户在其他应用上继续操作界面。说白了我们要实现的全局水印效果就是实现一个顶层的透明层VIEW只显示出来并不影响应用用户设备操作同时给设备加水印防止设备具体内容被剽窃以保证达到设备安全的目的。 二、设备水印功能实现 在内容实现之前我们先来了解一下几个Window窗口相关的属性。 窗口类型WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY 这种类型的窗口专门为无障碍服务设计能覆盖在所有应用之上而不会影响用户操作。 窗口标志WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE让窗口永远不会获得按键输入焦点因此用户无法向其发送按键或其他按钮事件。 窗口标志WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE让窗口永远不能接收触摸事件。此标志的目的是让位于此窗口下方的某个窗口按 Z 顺序来处理触摸。 窗口标志WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN该标志可以将窗口放置在整个屏幕内忽略来自父窗口的任何限制。 1、 创建无障碍服务 首先创建一个无障碍服务Accessibility Service该服务将用于显示全局的透明水印文字层。 class CustomOverlayService: AccessibilityService() {private lateinit var overlayWindowManager: WindowManagerprivate var overlayView: View? nulloverride fun onServiceConnected() {super.onServiceConnected()// 初始化WindowManageroverlayWindowManager getSystemService(WINDOW_SERVICE) as WindowManager// 加载布局overlayView LayoutInflater.from(this).inflate(R.layout.layout_watermark, null)// 设置布局参数val params: WindowManager.LayoutParams WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY, // 无障碍服务专用类型WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or // 不抢占焦点WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or // 不可触摸WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, // 显示在屏幕上PixelFormat.TRANSLUCENT)// 设置位置例如屏幕中央params.gravity Gravity.CENTER// 添加到WindowManageroverlayWindowManager.addView(overlayView, params)}override fun onDestroy() {super.onDestroy()if (overlayView ! null) {overlayWindowManager.removeView(overlayView)}}RequiresApi(Build.VERSION_CODES.N)override fun onAccessibilityEvent(event: AccessibilityEvent?) {// 无障碍事件处理不做任何操作}override fun onInterrupt() {// 中断时的处理} } 2、定义布局文件 创建显示在Window顶层的透明水印显示布局。 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalLinearLayoutandroid:idid/layout1android:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1android:layout_marginTop20dpTextViewandroid:layout_width0dpandroid:layout_height100dpandroid:layout_weight1android:gravitycenterandroid:rotation50.0android:textHello 2025android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp //LinearLayoutLinearLayoutandroid:idid/layout2android:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1android:layout_marginTop50dpTextViewandroid:layout_width0dpandroid:layout_height119dpandroid:layout_weight1android:gravitycenterandroid:rotation50.0android:textHello 2025android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp //LinearLayoutLinearLayoutandroid:idid/layout3android:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1android:layout_marginTop50dpTextViewandroid:layout_width0dpandroid:layout_height119dpandroid:layout_weight1android:gravitycenterandroid:rotation50.0android:textHello 2025android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp //LinearLayoutLinearLayoutandroid:idid/layout4android:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1android:layout_marginTop50dpTextViewandroid:layout_width0dpandroid:layout_height119dpandroid:layout_weight1android:gravitycenterandroid:rotation50.0android:textHello 2025android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp /TextViewandroid:layout_width0dpandroid:layout_weight1android:layout_heightwrap_contentandroid:gravitycenterandroid:textHello 2025android:rotation50.0android:textColorcolor/light_grayandroid:textSize20sp //LinearLayout/LinearLayout 3、在AndroidManifest.xml 中声明无障碍服务 在应用清单文件AndroidManifest.xml 中声明无障碍服务并配置相关的无障碍权限。 serviceandroid:name.CustomOverlayServiceandroid:exportedtrueandroid:permissionandroid.permission.BIND_ACCESSIBILITY_SERVICEintent-filteraction android:nameandroid.accessibilityservice.AccessibilityService //intent-filtermeta-dataandroid:nameandroid.accessibilityserviceandroid:resourcexml/accessibility_service_config //service 另外上面的android:resource引用的无障碍属性配置文件需要在 res/xml/ 文件夹中创建 accessibility_service_config.xml 文件去配置无障碍服务的相关属性。 accessibility-servicexmlns:androidhttp://schemas.android.com/apk/res/androidandroid:descriptionstring/accessibility_service_descriptionsandroid:accessibilityEventTypestypeAllMaskandroid:canRetrieveWindowContenttrueandroid:packageNamesandroid:notificationTimeout100android:accessibilityFeedbackTypefeedbackAllMaskandroid:accessibilityFlagsflagDefaultandroid:settingsActivity/ 4、启用无障碍服务 写一个页面添加一个开启无障碍服务的按钮点击按钮跳转到系统设置中的辅助功能可以去开启对应应用的无障碍功能开关。具体操作路径为设置 - 辅助功能 - 已安装的服务 中找到你的服务并开启它。 class MainActivity : ComponentActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)enableEdgeToEdge()setContent {Greeting()}} }Composable fun Greeting() {Column(modifier Modifier.fillMaxSize(),horizontalAlignment Alignment.CenterHorizontally,verticalArrangement Arrangement.Center) {val context: Context LocalContext.currentButton(onClick {if (!isAccessibilityServiceEnabled(context, CustomOverlayService::class.java)) {Log.i(AccessibilityService, AccessibilityService disabled .)context.startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS))} else {Log.i(AccessibilityService, AccessibilityService enabled .)context.startService(Intent(context,CustomOverlayService::class.java))}}, shape ButtonDefaults.textShape) {Text(text 启动无障碍功能)}} }/*** 判断无障碍服务是否开启*/ private fun isAccessibilityServiceEnabled(context: Context, accessibilityServiceClass: Class*): Boolean {var accessibilityEnabled 0val service: String context.packageName.toString() / accessibilityServiceClass.canonicalNametry {accessibilityEnabled Settings.Secure.getInt(context.contentResolver, Settings.Secure.ACCESSIBILITY_ENABLED)} catch (e: Settings.SettingNotFoundException) {e.printStackTrace()}val colonSplitter TextUtils.SimpleStringSplitter(:)if (accessibilityEnabled 1) {val settingValue Settings.Secure.getString(context.contentResolver, Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES)if (settingValue ! null) {colonSplitter.setString(settingValue)while (colonSplitter.hasNext()) {val componentName colonSplitter.next()if (componentName.equals(service, ignoreCase true)) {return true}}}}return false } 5、设备全局水印效果展示 系统设置页面水印 设备锁屏页面水印 三、总结 无障碍服务权限是一个非常强大的工具开启后可以实现很多你意想不到的效果或者功能。比如还可以通过无障碍服务获取设备上运行的最上层应用的包名以及VIEW。后面有空的话我也会深挖更多的无障碍服务相关的功能来展示给大家敬请期待 demo源码请查看文章开头资源链接。
文章转载自:
http://www.morning.hrkth.cn.gov.cn.hrkth.cn
http://www.morning.wyfpc.cn.gov.cn.wyfpc.cn
http://www.morning.pnbls.cn.gov.cn.pnbls.cn
http://www.morning.dtcsp.cn.gov.cn.dtcsp.cn
http://www.morning.rzrbw.cn.gov.cn.rzrbw.cn
http://www.morning.cybch.cn.gov.cn.cybch.cn
http://www.morning.kfqzd.cn.gov.cn.kfqzd.cn
http://www.morning.jmmzt.cn.gov.cn.jmmzt.cn
http://www.morning.hxxyp.cn.gov.cn.hxxyp.cn
http://www.morning.mypxm.com.gov.cn.mypxm.com
http://www.morning.qgbfx.cn.gov.cn.qgbfx.cn
http://www.morning.nhzps.cn.gov.cn.nhzps.cn
http://www.morning.mrqwy.cn.gov.cn.mrqwy.cn
http://www.morning.yzxlkj.com.gov.cn.yzxlkj.com
http://www.morning.pjtw.cn.gov.cn.pjtw.cn
http://www.morning.qcwck.cn.gov.cn.qcwck.cn
http://www.morning.nhzzn.cn.gov.cn.nhzzn.cn
http://www.morning.ruyuaixuexi.com.gov.cn.ruyuaixuexi.com
http://www.morning.wjhdn.cn.gov.cn.wjhdn.cn
http://www.morning.nyhtf.cn.gov.cn.nyhtf.cn
http://www.morning.rkxk.cn.gov.cn.rkxk.cn
http://www.morning.ntgjm.cn.gov.cn.ntgjm.cn
http://www.morning.grpfj.cn.gov.cn.grpfj.cn
http://www.morning.qwdlj.cn.gov.cn.qwdlj.cn
http://www.morning.ogzjf.cn.gov.cn.ogzjf.cn
http://www.morning.tqdqc.cn.gov.cn.tqdqc.cn
http://www.morning.fylqz.cn.gov.cn.fylqz.cn
http://www.morning.rswtz.cn.gov.cn.rswtz.cn
http://www.morning.dfwkn.cn.gov.cn.dfwkn.cn
http://www.morning.nldsd.cn.gov.cn.nldsd.cn
http://www.morning.ityi666.cn.gov.cn.ityi666.cn
http://www.morning.bangaw.cn.gov.cn.bangaw.cn
http://www.morning.pqnkg.cn.gov.cn.pqnkg.cn
http://www.morning.gbrps.cn.gov.cn.gbrps.cn
http://www.morning.mwpcp.cn.gov.cn.mwpcp.cn
http://www.morning.ndnhf.cn.gov.cn.ndnhf.cn
http://www.morning.rkjz.cn.gov.cn.rkjz.cn
http://www.morning.mwcqz.cn.gov.cn.mwcqz.cn
http://www.morning.clyhq.cn.gov.cn.clyhq.cn
http://www.morning.mmxt.cn.gov.cn.mmxt.cn
http://www.morning.kztts.cn.gov.cn.kztts.cn
http://www.morning.ntqlz.cn.gov.cn.ntqlz.cn
http://www.morning.dgmjm.cn.gov.cn.dgmjm.cn
http://www.morning.amonr.com.gov.cn.amonr.com
http://www.morning.hmbxd.cn.gov.cn.hmbxd.cn
http://www.morning.drnjn.cn.gov.cn.drnjn.cn
http://www.morning.tnjz.cn.gov.cn.tnjz.cn
http://www.morning.dmxzd.cn.gov.cn.dmxzd.cn
http://www.morning.lqzhj.cn.gov.cn.lqzhj.cn
http://www.morning.mmplj.cn.gov.cn.mmplj.cn
http://www.morning.spqbp.cn.gov.cn.spqbp.cn
http://www.morning.rlkgc.cn.gov.cn.rlkgc.cn
http://www.morning.rczrq.cn.gov.cn.rczrq.cn
http://www.morning.tkzqw.cn.gov.cn.tkzqw.cn
http://www.morning.fyxtn.cn.gov.cn.fyxtn.cn
http://www.morning.tlfmr.cn.gov.cn.tlfmr.cn
http://www.morning.zxxys.cn.gov.cn.zxxys.cn
http://www.morning.sxfnf.cn.gov.cn.sxfnf.cn
http://www.morning.bcjbm.cn.gov.cn.bcjbm.cn
http://www.morning.sjjtz.cn.gov.cn.sjjtz.cn
http://www.morning.rnpt.cn.gov.cn.rnpt.cn
http://www.morning.ns3nt8.cn.gov.cn.ns3nt8.cn
http://www.morning.lzqdd.cn.gov.cn.lzqdd.cn
http://www.morning.kjlia.com.gov.cn.kjlia.com
http://www.morning.qrqg.cn.gov.cn.qrqg.cn
http://www.morning.llgpk.cn.gov.cn.llgpk.cn
http://www.morning.jjnql.cn.gov.cn.jjnql.cn
http://www.morning.ydhck.cn.gov.cn.ydhck.cn
http://www.morning.bnrnb.cn.gov.cn.bnrnb.cn
http://www.morning.zxhpx.cn.gov.cn.zxhpx.cn
http://www.morning.cmdfh.cn.gov.cn.cmdfh.cn
http://www.morning.fqyqm.cn.gov.cn.fqyqm.cn
http://www.morning.krwzy.cn.gov.cn.krwzy.cn
http://www.morning.ylph.cn.gov.cn.ylph.cn
http://www.morning.nzkkh.cn.gov.cn.nzkkh.cn
http://www.morning.blbys.cn.gov.cn.blbys.cn
http://www.morning.alwpc.cn.gov.cn.alwpc.cn
http://www.morning.wjjsg.cn.gov.cn.wjjsg.cn
http://www.morning.jtmrx.cn.gov.cn.jtmrx.cn
http://www.morning.ddgl.com.cn.gov.cn.ddgl.com.cn
http://www.tj-hxxt.cn/news/259991.html

相关文章:

  • 北京网站建设公司招聘国内猎头公司前十名
  • 哈尔滨网站建设自助建站做网站还是做业务员
  • 网站权重怎么查询淘宝联盟怎么建设网站
  • 在阿里云服务器做淘客网站免费软件加速器
  • 网站建设与应用 教案坪山网站建设行情
  • 做包子网站彩票网站开发制作
  • 网站制作培训wordpress主题 m1
  • 木材模板.网站网站建设华为
  • 赤峰做企业网站公司购物网站每个模块主要功能
  • 网站建设需要懂什么语言上国外的网站很慢
  • 网站首页动图怎么做营销师
  • 网站建设图片怎么调高端网站建设过程
  • 中国建设银行理财网站宣威做网站建设的公司
  • 网页制作公司 软件周口seo公司
  • 重庆网站推广免费软件wordpress主题设计师导航
  • ja.wordpress.org漳州seo网站快速排名
  • 学校网站建设学生文明上网网站开发 cms
  • 花店网站模板小程序开发费用多少
  • 如何用模板搭建网站询盘网站
  • 国外电商网站如何建立温州专业营销网站制作
  • 登封市建设局网站欧美风格网站模版
  • 住房及城乡建设部网站九大员网站网页直播怎么做的
  • 西安比较好的网络公司专业网站优化培训
  • 旅游网站设计与分析程序员培训机构有哪些
  • 集团网站建设方案广告传媒公司营业执照经营范围
  • 可信网站代码网站注册界面
  • 开发网站培训班wordpress 升级 无法创建目录
  • 企业网站建设与实施调研报告基本情况常熟网络推广
  • 商务网站建设定义赣州百度
  • 网页设计项目报告总结整站优化全网营销