Android image Selector Rich configuration options _android

Source: Internet
Author: User

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.



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://

Depend on

dependencies {
 compile ' com.yuyh.imgsel:library:1.0.1 '


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"/>


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.
  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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.