技术控

    今日:136| 主题:49552
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Android accessibility debugging with Stetho

[复制链接]
回首望不到邊 发表于 2016-10-18 05:12:54
250 4

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Android has a powerful built-in accessibility system that allows people to use applications through an alternative interaction mode called “focus navigation.” Rather than directly touching the screen to activate an element, focus navigation allows people who use accessibility services such as screen readers, physical switch devices, refreshable Braille displays, or voice control to focus on and activate different elements of an interface.
  Although focus navigation is built into the Android platform, many engineers don’t consider it when designing, building, and testing their applications. This can lead to a variety of problems, such as the inability to activate buttons or content being announced in the wrong order, which can be difficult to debug.
   Accessibility is important to our work at Facebook, so to help with the above challenges we’ve added support for accessibility properties toStetho, our open source Android debugging tool. Now engineers can easily find elements that aren’t accessible through focus navigation, understand the reasons behind the bug, and implement a fix.
  Let’s go over an example of a UI with a focus navigation issue and show how Stetho makes the problem easier to debug.
     
Android accessibility debugging with Stetho-1 (Android,navigation,Facebook,difficult,different)
      Screenshot showing the currently focused element highlighted in green.      Example problem

   In this fairly simple UI, there are two TextView s and a Button inside a LinearLayout . The LinearLayout is found inside a ListView .
  [code]         xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
                       android:text="Heading One"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              />
                       android:text="Action"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              />
                       android:text="Heading Two"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              />
[/code]   Which views would you expect to be focusable? If you answered "the TextView s and the Button ," you'd be wrong. The correct answer is the Button and the LinearLayout .
   Since focus will first fall on the LinearLayout , screen reader users will hear the content of both TextView s before the Button that is between them. This could cause confusion if the context of the button's action depended on being preceded by the first heading. For example, if the button said “Buy Now,” and the headings were the names of two different products, a user may not understand which product they would be purchasing by clicking the button. So why is this the case, how can we fix it, and most importantly, how could we have predicted this would happen?
  Well, you could run every view through this flow chart, and keep note of what is focusable and what isn't.

Android accessibility debugging with Stetho-2 (Android,navigation,Facebook,difficult,different)
      A flow chart showing exactly why a given view may or may not be focusable.      Stetho

   Or you could use Stetho! Stetho is an Android debugging platform that we open sourced last year . Since then, we've added a ton of new features, including accessibility inspection.
123下一页
友荐云推荐




上一篇:Why Do People Fall in Love with Ruby?
下一篇:Happy 15th Birthday Red Hat Product Security
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

乐巧 发表于 2016-10-19 07:37:47
本宫准楼下的继续跟帖。。。
回复 支持 反对

使用道具 举报

蒋鑫 发表于 2016-10-22 02:11:16
元芳你怎么看?
回复 支持 反对

使用道具 举报

胡瑞 发表于 2016-11-5 14:34:38
你长的比假奶粉的毒性都大,我看了就头大。
回复 支持 反对

使用道具 举报

875456 发表于 2016-11-7 19:49:48
运气就是机会碰巧撞到了你的努力。
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表