作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试重新制作房地产应用程序的代码,当我尝试重建项目时,我在 ItemProfile.java inline 10 中收到此错误和这一行“public class ItemProfile extends DragAdapter”
这是 ItemProfile.java 文件:
package com.aqar.goestate.Item;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import com.aqar.goestate.R;
import com.squareup.picasso.Picasso;
import com.wonshinhyo.dragrecyclerview.DragAdapter;
import com.wonshinhyo.dragrecyclerview.DragHolder;
import com.wonshinhyo.dragrecyclerview.DragRecyclerView;
import java.util.ArrayList;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by otacodes on 11/16/2018.
*/
public class ItemProfile extends DragAdapter {
Context context;
ArrayList<String> photos;
private ItemProfile.OnItemClickListener listener;
public interface OnItemClickListener {
void onItemClick(String item, int postion, View view);
}
public ItemProfile(Context context, ArrayList<String> arrayList, ItemProfile.OnItemClickListener listener) {
super(context,arrayList);
this.context=context;
photos=arrayList;
this.listener=listener;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewtype) {
return new HistoryviewHolder(LayoutInflater.from(getContext()).inflate(R.layout.item_editprofile, viewGroup, false));
}
@Override
public int getItemCount() {
return photos.size();
}
@Override
public void onBindViewHolder(final DragRecyclerView.ViewHolder hol, final int position) {
super.onBindViewHolder(hol, position);
HistoryviewHolder holder = (HistoryviewHolder) hol;
holder.bind(photos.get(position),position,listener);
if(photos.get(position).equals("")){
holder.cancelButton.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_add));
Picasso.with(context).load("null").placeholder(R.drawable.image_placeholder).centerCrop().resize(200,300).into(holder.image);
}else {
holder.cancelButton.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_cancel));
Picasso.with(context).load(photos.get(position)).placeholder(R.drawable.image_placeholder).centerCrop().resize(200,300).into(holder.image);
}
}
/**
* Inner Class for a recycler getView
*/
class HistoryviewHolder extends DragHolder {
View getView;
CircleImageView image;
ImageButton cancelButton;
public HistoryviewHolder(View itemView) {
super(itemView);
getView = itemView;
image = getView.findViewById(R.id.image);
cancelButton = getView.findViewById(R.id.button);
}
public void bind(final String item, final int position , final ItemProfile.OnItemClickListener listener) {
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClick(item,position,v);
}
});
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClick(item,position,v);
}
});
}
}
}
这是 build.gradle:模块应用程序文件:
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 28
defaultConfig {
applicationId 'com.aqar.goestate'
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "47e2631c-6c27-4a76-b3de-8698450f32b2",
onesignal_google_project_number: "REMOTE"]
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// multiDexKeepFile file('multidex-config.txt')
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.onesignal:OneSignal:3.10.5@aar'
implementation 'com.github.ornolfr:rating-view:0.1.2@aar'
implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.android.support:recyclerview-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-database:18.0.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-storage:18.1.1'
implementation 'com.google.android.gms:play-services-ads:18.1.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.yesterselga:country-picker-android:1.0'
implementation 'com.soundcloud.android:android-crop:1.0.1@aar'
implementation 'com.android.support:design:28.0.0'
implementation project(':httpclient')
implementation 'com.github.bumptech.glide:glide:4.4.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.mindorks.android:prdownloader:0.4.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
implementation 'me.everything:overscroll-decor-android:1.0.4'
implementation 'com.labo.kaji:fragmentanimations:0.1.1'
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.facebook.android:facebook-android-sdk:4.26.0'
implementation 'com.gmail.samehadar:iosdialog:1.0'
implementation 'com.github.channguyen:rsv:1.0.1'
implementation 'com.github.Jay-Goo:RangeSeekBar:v2.0.6'
implementation 'net.the4thdimension:audio-wife:1.0.3'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.wonshinhyo:dragrecyclerview.realm:1.0.5'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation('com.giphy.sdk:core:1.0.2@aar') {
transitive = true
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
testImplementation 'junit:junit:4.12'
implementation 'com.wonshinhyo:dragrecyclerview:1.1.0'
implementation 'com.wonshinhyo:dragrecyclerview.realm.adapter:1.0.0'
implementation 'io.realm:android-adapters:3.1.0'
}
apply plugin: 'com.google.gms.google-services'
这是 build.gradle:项目文件
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://giphy.bintray.com/giphy-sdk" }
maven { url "https://maven.google.com" }
maven { url 'https://jitpack.io' }
maven { url 'https://jcenter.bintray.com/' }
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最佳答案
只需从https://mvnrepository.com/artifact/com.wonshinhyo/dragrecyclerview/1.0.0下载dragrecyclerview-1.0.0.aar并手动将其安装到您的应用程序中。
关于java - 如何解决此错误 : cannot find symbol class DragAdapter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57469583/
我正在尝试重新制作房地产应用程序的代码,当我尝试重建项目时,我在 ItemProfile.java inline 10 中收到此错误和这一行“public class ItemProfile exte
我是一名优秀的程序员,十分优秀!