Recently it was just a project, so I started writing a library of Android picture selectors. Support gallery multiple selection/radio/Picture cropping/Photo/Custom picture loading library, greatly simplifies the use.
Screenshots
Advantages
1, through the implementation of Imageloader interface, you can implement the custom picture loader function. For example, you can use glide, Picasso, Imageloader, temporarily do not support fresco, because Simpledraweeview itself does not belong to ImageView. Of course, the same idea can be used to achieve.
2, can configure the imgselconfig. Easy to expand.
3. Simplify the Use
Project address:Https://github.com/smuyyh/ImageSelector
Depend on
dependencies {
compile ' com.yuyh.imgsel:library:1.0.1 '
}
Use
Configure permissions
<uses-permission android:name= "Android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name= "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
Use
Custom picture Loader private Imageloader loader = new Imageloader () {@Override public void displayimage (context, String Path, ImageView ImageView) {//TODO Here you can customize the picture loading library to load ImageView, such as Glide, Picasso, Imageloader, and so on glide.with (context). Load (
Path). into (ImageView);
}
}; Configuration options Imgselconfig config = new Imgselconfig.builder (loader)//whether multiple selections. MultiSelect (FALSE)//OK button background color. Btnbgcolo
R (Color.gray)//OK button text color. Btntextcolor (Color.Blue)//title. Title ("Picture")//Title text color. Titlecolor (Color.White) TitleBar background color. Titlebgcolor (Color.parsecolor ("#3F51B5"))//crop size. When Needcrop is true, configure. Cropsize (1, 1,). Needcrop (True)//The first camera is displayed. Needcamera (FALSE)//maximum number of pictures selected. MAXN
Um (9). build ();
Jump to the picture selector imgselactivity.startactivity (this, config, request_code); @Override protected void Onactivityresult (int requestcode, int resultcode, Intent data) {Super.onactivityresult (Request
Code, ResultCode, data); Picture selection result Callback if (Requestcode = = Request_code && ResultCode = = RESULT_OK && data!= null) {list<string> pathlist = Data.getstringarraylistextra (ImgSelActi Vity.
Intent_result);
for (String path:pathlist) {tvresult.append (path + "\ n");
}
}
}
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.