【发布时间】:2012-06-28 15:35:36
【问题描述】:
我已将 zxing 完全包含在我的应用程序中,以使其独立。 它可以工作,但是相机是旋转的(我认为是逆时针旋转 90 度),并且它周围有一个奇怪的填充物。 我的java:
package it.mi.action.codmmunicator_2ddecoder;
import android.os.Bundle;
import android.widget.Toast;
import android.graphics.Bitmap;
import com.google.zxing.Result;
import com.google.zxing.client.android.CaptureActivity;
public class Lettore extends CaptureActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lettore);
}
@Override
public void handleDecode(Result rawResult, Bitmap barcode) {
Toast.makeText(this.getApplicationContext(), "Scanned code " + rawResult.getText(), Toast.LENGTH_LONG);
}
}
还有我的 xml(包括 zxing 的活动):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<ImageView android:src="@drawable/head" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<FrameLayout android:layout_width="fill_parent" android:layout_height="250dip">
<include layout="@layout/capture" android:toDegrees="90" />
</FrameLayout>
</LinearLayout>
填充是这样的:https://dl.dropbox.com/u/16047047/Untitled-1.jpg
有人可以发布解决方案吗?
非常感谢
【问题讨论】:
-
从您的应用程序中删除它并与 Intents 集成。这是该系统的使用方式。我保证,这会让你的头痛大大减少。
-
但我不能......它必须出现在我的视图中,而不是新的意图(在全屏的新视图中出现)。如果我可以在我的观点中整合一个意图,那没关系,但我不知道如何。换句话说:这些东西必须像我的屏幕一样:看到下面有图像吗?并且相机是集成的?
-
为什么“必须”出现在您自己的视图中?创建 BarcodeScanner 的人做得非常出色。并为您提供了一种将其与您自己的应用程序集成的简单方法。通过尝试将其源代码复制/粘贴到您的应用程序中,您正在“向上游泳”。这样做会带来更多的麻烦。
-
因为我必须这样做。我的客户想要它。在 iphone 应用程序中,编码器做到了,我没有复制源代码,我通过 ecplipse 中的库将其集成
-
没有办法在我的视图中抛出一个意图?我想一定有办法……
标签: android include frame qr-code zxing