我正在使用Zxing库在Android中开发条形码扫描仪。扫描仪可以正常工作,但用于扫描的相机视图却像屏幕截图中所示那样颠倒了。如何解决?
答案 0 :(得分:0)
将应用程序的屏幕方向设置为sensorLandscape而不是横向
答案 1 :(得分:0)
尝试调整相机方向
public HttpResponseMessage GetDetails(string msn, DateTime dt)
{
try
{
var mainDetails= new List<string>();
int mainCount = giveMainCount(msn, dt);
if(mainCount==0)
{
// here I want to set the list empty like mainDetails = null or "" like this
}
int mainInterval = mainCount / 500;
mainDetails = kesc.tj_xhqd
.AsNoTracking()
.Where(m => (m.zdjh == msn) && (m.sjsj >= dt))
.AsEnumerable()
.Select((x, i) => new { MSN = x.zdjh, PingDateTime = x.sjsj, PingValue = x.xhqd, i = i })
.Where(x => x.i % mainInterval == 0)
.ToList(); // here I am getting error
return Request.CreateResponse(HttpStatusCode.OK, new { details = mainDetails });
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
}
}
}
并在清单中声明如下:
camera.setDisplayOrientation(90);
对于纵向和横向,请在<activity
android:name="CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation" />
中添加行
integrator