你好我在构建我的应用程序时面临这个问题我搜索了互联网并发现没有任何线索,安卓工作室给我这个警告我的应用程序运行没有问题,但如果有人可以澄清这是什么以及如何解决它:
(ImageGallery.java: 使用或覆盖已弃用的API。 使用-Xlint重新编译:弃用以获取详细信息。)
这是ImageGallery.java
package com.akofahi.tourjordan;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.ImageView;
import com.veinhorn.scrollgalleryview.MediaInfo;
import com.veinhorn.scrollgalleryview.ScrollGalleryView;
import com.veinhorn.scrollgalleryview.loader.DefaultImageLoader;
import com.veinhorn.scrollgalleryview.loader.MediaLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ImageGallery extends FragmentActivity {
private static final ArrayList<String> images = new ArrayList<>(Arrays.asList(
"",
"",
""
));
private static final String movieUrl = "";
private ScrollGalleryView scrollGalleryView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sub_about_readmore_image_gallary);
List<MediaInfo> infos = new ArrayList<>(images.size());
for (String url : images) infos.add(MediaInfo.mediaLoader(new PicassoImageLoader(url)));
scrollGalleryView = (ScrollGalleryView) findViewById(R.id.imgGallery);
scrollGalleryView
.setThumbnailSize(100)
.setZoom(true)
.setFragmentManager(getSupportFragmentManager())
.addMedia(MediaInfo.mediaLoader(new DefaultImageLoader(R.drawable.petra)))
.addMedia(MediaInfo.mediaLoader(new DefaultImageLoader(toBitmap(R.drawable.ram))))
.addMedia(MediaInfo.mediaLoader(new MediaLoader() {
@Override
public boolean isImage() {
return true;
}
@Override
public void loadMedia(Context context, ImageView imageView,
MediaLoader.SuccessCallback callback) {
imageView.setImageBitmap(toBitmap(R.drawable.wadi));
callback.onSuccess();
}
@Override
public void loadThumbnail(Context context, ImageView thumbnailView,
MediaLoader.SuccessCallback callback) {
thumbnailView.setImageBitmap(toBitmap(R.drawable.wadi));
callback.onSuccess();
}
}))
.addMedia(infos);
}
private Bitmap toBitmap(int image) {
return ((BitmapDrawable) getResources().getDrawable(image)).getBitmap();
}
}
这是我的gradle.build:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.akofahi.tourjordan"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "com.android.support:support-v4:27.1.1"
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.veinhorn.scrollgalleryview:library:1.0.8'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}