我正在尝试将Google Visions扫描程序应用到我正在开发的应用程序中.默认情况下,它会在整个屏幕上跟踪全屏活动和条形码.
但是,我需要全屏摄像头,但扫描窗口有限.例如,相机的表面视图需要全屏,它有2个透明覆盖设置为屏幕高度顶部和底部的35%,在中心留下30%的视口.
我已经更改了图形叠加层,因此它只会显示在中间视口中,但还无法确定如何将条形码跟踪器限制在同一区域.
有任何想法吗?
我最近开始涉足矢量图像和动画.但是,一旦路径变形动画完成,我希望能够在所有方向上均匀地缩放我的图像.
我尝试过在任何地方应用pivotX和Y但它似乎没有什么区别.
我怎样才能实现中心规模,而不仅仅是从左到右扩展?
test_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/test_image"
android:layout_gravity="center"
android:src="@drawable/animated_logo"
android:layout_width="200dp"
android:layout_height="200dp" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
animated_logo.xml
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/closed_logo" >
<target
android:animation="@anim/scale"
android:name="logo"/>
</animated-vector>
Run Code Online (Sandbox Code Playgroud)
scale.anim
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:duration="1500"
android:propertyName="scaleX"
android:valueFrom="1.0"
android:valueTo="10"
android:valueType="floatType"/>
<objectAnimator
android:duration="1500"
android:propertyName="scaleY"
android:valueFrom="1.0"
android:valueTo="10"
android:valueType="floatType"/>
Run Code Online (Sandbox Code Playgroud)
closed_logo.xml
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="75"
android:viewportHeight="75"
android:width="1000dp"
android:height="1000dp">
<group android:name="logo">
<path
android:name="box"
android:fillColor="#DADADA"
android:pathData="M65.5,54.4L11.1,65.5L0,11.1L54.4,0L65.5,54.4z"/>
<path
android:name="bottom_left"
android:fillColor="#47A89C"
android:pathData="M 7.1,22.2 l 15.2,36.0 l 10.4,-25.6 L 32.699997,32.6 L 7.1,22.2 L 7.1,22.2z" />
<path …Run Code Online (Sandbox Code Playgroud)