嘿伙计们我正在使用recyclerview来显示我的图片,但他们同时复制了我在Google搜索此问题的vaule我发现了this和this以及this或更多,但没有人正在帮助
我的代码是
class PaypalnvpComponent {
private static $API_Username = PAYPAL_API_USERNAME;
private static $API_Password = PAYPAL_API_PASSWORD;
private static $API_Signature = PAYPAL_API_SIGNATURE;
private static $API_Environment = PAYPAL_API_MODE;
private static $API_Version = '116.0';
public static function Call($methodName,$params){
if(self::$API_Environment == 'LIVE'){
$API_Endpoint = "https://api-3t.paypal.com/nvp";
}else{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
}
$nvpstr = "";
foreach($params as $k=>$v){
$nvpstr .="&".$k."=".urlencode($v);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//Turn of server and pakagemanager
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
//set the API operation,version,API signature in requrest
$nvpreq ="";
$nvpreq .= "METHOD=".urlencode($methodName);
$nvpreq .= "&VERSION=".urlencode(self::$API_Version);
$nvpreq .= "&PWD=".urlencode(self::$API_Password);
$nvpreq .= "&USER=".urlencode(self::$API_Username);
$nvpreq .= "&SIGNATURE=".urlencode(self::$API_Signature);
$nvpreq .= $nvpstr;
//set the request as POST field for curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
//get the response from server
$httpResponse = curl_exec($ch);
if(!$httpResponse){
return "$methodName failed:".curl_error($ch).'('.curl_errno($ch).')';
}
//Extract the response details
$httpResponseArray = explode('&', $httpResponse);
$httpParsedResponseArray = array();
foreach ($httpResponseArray as $i=>$value){
$tmpArray = explode('=', $value);
if(sizeof($tmpArray) > 1){
$httpParsedResponseArray[$tmpArray[0]] = urldecode($tmpArray[1]);
}
}
if((0 == sizeof($httpParsedResponseArray)) || !array_key_exists('ACK',$httpParsedResponseArray)){
return "Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.";
}
return $httpParsedResponseArray;
}
#----------------------------
# @$hok
# mass payment with multiple users in one go
# paypal transaction status will be : Completed, Failed, Returned, Reversed, Unclaimed, Pending, Blocked
#----------------------------
public static function MassPay($params){
$methodName = "MassPay";
return self::Call($methodName, $params);
}
public static function GetTransactionDetail($params){
$methodName = "GetTransactionDetails";
return self::Call($methodName, $params);
}
public static function TransactionSearch($params){
$methodName = "TransactionSearch";
return self::Call($methodName, $params);
}
}
# below is the example how to use above class
$params = array();
$params["RECEIVERTYPE"] = "EmailAddress";
$params["EMAILSUBJECT"] = "Your withdraw request was processed";
$params["L_AMT0"] = 1;
$params["L_EMAIL0"] = "xyz@xyz.abc";
$params["L_UNIQUEID0"] = rand(11111,9999999);
$params["L_AMT1"] = 2;
$params["L_EMAIL1"] = "hamed-buyer@lifeofu.com";
$params["L_UNIQUEID1"] = rand(11111,9999999);
$params["L_AMT2"] = 3;
$params["L_EMAIL2"] = "testuser1@test1.com";
$params["L_UNIQUEID2"] = rand(11111,9999999);
$params["CURRENCYCODE"] = "USD";
$result = PaypalnvpComponent::MassPay($params);
//transaction detial
$params = array();
$params["TRANSACTIONID"] = TRANSACTIONID_HERE;
$result = PaypalnvpComponent::GetTransactionDetail($params);
答案 0 :(得分:3)
将布局中的高度((R.layout.img_row)更改为wrap_content而不是match_content
答案 1 :(得分:1)
我怀疑您可能听说setHasStableIds(true)
加快了您的回收视图,但请尝试将其删除或设置为false。
所以,试试这个:
setHasStableIds(false);
然后让我知道会发生什么;
我有这个问题,有时候项目是重复的,有时根本就没有出现过,在删除该方法调用后,它解决了我的问题!
祝你好运,编码愉快!
答案 2 :(得分:0)
用以下内容替换上面的行:
public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ViewHolder> {
@Override
public ImageAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.img_row, parent, false);
ImageAdapter.ViewHolder viewHolder = new ImageAdapter.ViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(final ImageAdapter.ViewHolder holder, final int position) {
ImgModel model = listmodel.get(holder.getAdapterPosition()
);
...........
..............
}
}