我正在使用https://github.com/chrisbanes/PhotoView在我的自定义imageview上启用捏合缩放功能,但是,我在切换按钮上实现该功能时遇到问题。当用户点击切换按钮时,我想让图像变焦。缩放后,当用户单击关闭缩放按钮时,图像仍应位于其缩放位置但不可缩放(因为我有另一个onTouchListener,用户可以单击并检测图像的颜色)。问题是,当切换按钮改变状态(开启到关闭)时,缩放将重置。请帮助我,对不起我的可怕解释。谢谢。
以下是我的代码的一部分:
.Send
更新:下面是我为ImageView设置onTouch事件以获取像素颜色的活动。 (而PhotoView库也会覆盖onTouch以启用图像缩放)。我尝试从这个问题实现该方法:Android PhotoView Keep Zoom After Orientation Change以保持缩放尺寸/缩放尺寸处于不同的切换按钮状态,但我无法理解CDO.Message
是什么。我希望你能够理解我的问题是什么。感谢。
ImageEditorActivity.java:
case R.id.btnZoom:
PhotoViewAttacher photoView= new PhotoViewAttacher(ivImageEditor);
photoView.update();
if(btnZoom.isChecked()){
//photoView.setZoomable(true);
}else if (!btnZoom.isChecked()){
photoView.setZoomable(false);
}
break;
答案 0 :(得分:0)
以下是库中cordova plugin rm cordova-plugin-add-swift-support
cordova plugin add cordova-plugin-add-swift-support
和<?php
function paymentIpnlistener(){
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
// post back to PayPal system to validate
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
// If testing on Sandbox use:
$header .= "Host: www.paypal.com:443\r\n";
//$header .= "Host: ipnpb.paypal.com:443\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
if (strpos('ssl://www.paypal.com', 'sandbox') !== FALSE && function_exists('openssl_open')) {
$fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);
}
else{
// The old "normal" way of validating an IPN.
$fp = fsockopen('ssl://www.paypal.com', 80, $errno, $errstr, 30);
}
// If testing on Sandbox use:
//$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
//$fp = fsockopen ('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
// Add your live email address
$mail_From = "From: me@mybiz.com";
// Add your live email address
$mail_To = "raghbendra.nayak@systematixindia.com";
$mail_Subject = "VERIFIED IPN";
$mail_Body = $req;
foreach ($_POST as $key => $value){
$emailtext .= $key . " = " .$value ."\n\n";
}
mail($mail_To, $mail_Subject, $emailtext . "\n\n" . $mail_Body, $mail_From);
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
$mail_From = "From: me@mybiz.com";
$mail_To = "raghbendra.nayak@systematixindia.com";
$mail_Subject = "INVALID IPN";
$mail_Body = $req;
foreach ($_POST as $key => $value){
$emailtext .= $key . " = " .$value ."\n\n";
}
mail($mail_To, $mail_Subject, $emailtext . "\n\n" . $mail_Body, $mail_From);
}
} // while end
fclose ($fp);
}
}
?>
函数的代码。如您所见,每次调用update()
并setZoomable
为update()
时,他们都会重置可绘制矩阵。因此,没有内置的方法可以使用此库来保持图像的状态。
zoomable
以下是关于GitHub Repo的类似问题:Issue 168。解决方案是存储焦点和缩放图像的比例,然后设置:false
后,重新分配焦点和缩放比例。这可能有助于您实施解决方案:Android PhotoView Keep Zoom After Orientation Change。
希望它有所帮助!
答案 1 :(得分:0)
getSuppMatrix();
允许您保存PhotoView的当前状态。然后禁用或启用缩放并以以前的状态重新加载您的PhotoView。
尝试此操作以禁用PhotoView上的缩放:
Matrix theMatrix = new Matrix();
mPhotoView.getSuppMatrix(theMatrix);
mPhotoView.setZoomable(false);
mPhotoView.setDisplayMatrix(theMatrix);
这将重新启用缩放:
Matrix theMatrix = new Matrix();
mPhotoView.getSuppMatrix(theMatrix);
mPhotoView.setZoomable(true);
mPhotoView.setDisplayMatrix(theMatrix);