【问题标题】:scratch/touch problem detection in androidandroid中的划痕/触摸问题检测
【发布时间】:2020-05-07 04:58:33
【问题描述】:

我正在寻找一种解决方案来测试像 Amazon/Flipkart 等 Android 设备的触摸屏。

我可以获得任何具有类似功能的工作参考链接吗?

【问题讨论】:

    标签: android canvas touchscreen


    【解决方案1】:

    你试过ScratchView吗? ImageViewTextview 两者似乎很容易集成。

    您也可以查看tutorial

    此外,如果您想创建自己的解决方案,您可以在 ImageView 上放置一个视图,并使用StackOverflow answer 中提到的方法擦除 Bitmap。

    【讨论】:

    • 我想要测试手机触摸屏的代码来诊断触摸板中的问题。
    • 你的意思是你需要捕捉屏幕的坐标值,确切的故障在屏幕上吗?
    • 是的,您可以将其与亚马逊电话交换屏幕诊断相关联。
    【解决方案2】:

    使用这个库

    compile 'com.github.cooltechworks:ScratchView:v1.1'
    

    在您的xml 中使用可刮擦视图

    <com.cooltechworks.views.ScratchImageView
      android:id="@+id/sample_image"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@android:color/white"
      android:src="@drawable/img_sample2"
      />
    

    为您的草稿视图添加listener,如下所示并检查百分比

    scratchImageView.setRevealListener(new ScratchImageView.IRevealListener() {
        @Override
        public void onRevealed(ScratchImageView tv) {
            // on reveal
        }
    
        @Override
        public void onRevealPercentChangedListener(ScratchImageView siv, float percent) {
            // if the percent is 1, then whole portion is scratched
        }
    });
    

    欲了解更多信息https://github.com/sharish/ScratchView

    【讨论】:

    • 我想要测试手机触摸屏的代码来诊断触摸板中的问题。
    • 使用上述代码并将 ScratchImageView 设置为 match_parent。如果整个屏幕被划伤,即百分比为 1,则屏幕中的所有像素都在工作
    • 这可以是选项之一。
    猜你喜欢
    • 1970-01-01
    • 2017-01-18
    • 1970-01-01
    • 2010-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-06
    • 2013-06-29
    相关资源
    最近更新 更多