Android笔记

Android笔记

  • MagicIndicator
  • 图片选择器
  • Android Studio中找不到RecyclerView

MagicIndicator

在app下的build.gradle里面引入包之后,需要在Project下的build.gradle里面maven一下url:https://jitpack.io
1.app下的build.gradle文件引入库

dependencies {
	implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
}

2.Project下的build.gradle文件写入url

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

图片选择器

Uri imageUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
 ContentResolver contentResolver = context.getContentResolver();
 Cursor cursor = contentResolver.query(imageUri,new String[]{
                        MediaStore.Images.Media.DATA,
                        MediaStore.Images.Media.DISPLAY_NAME,
                        MediaStore.Images.Media.DATE_ADDED,
                        MediaStore.Images.Media._ID
                },null,null,MediaStore.Images.Media.DATE_ADDED);
ArrayList images = new ArrayList<>();
while (cursor.moveToNext()){
                    String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
                    String name = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));
                    long time = cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media.DATE_ADDED));
                    images.add(new Image(path,time,name));
                }
cursor.close();
Collections.reverse(images);
//                callback.onSuccess();

Android Studio中找不到RecyclerView

在build.gradle中增加代码

dependencies {
        implementation 'com.google.android.material:material:1.0.0'
}

你可能感兴趣的:(Android,android)