MaterialDialog


Source link: https://github.com/drakeet/MaterialDialog

Material Dialog v1.3.1

This is an Android library, I call it MaterialDialog. It's very easy to use. Just new it & call show() method, then the beautiful AlertDialog will show automatically. It is artistic, conforms to Google Material Design. I hope that you will like it, and enjoys it. ^ ^

Screenshots

You can also change the background with a image what you like. it's very easy!:

And with the v1.0.6, you can use the setContentView() to change the message view to your custom view.

Example:

Usage

Step 1

Gradle

dependencies {

  compile 'me.drakeet.materialdialog:library:1.3.1' 
}

If it doesn't work, please send me a email, [email protected]

Or

Import the library, then add it to your /settings.gradle and /app/build.gradle, if you don't know how to do it, you can read my blog for help.

Android Studio ????? jar ??????????

Step 2

It's very easy, just like this:

MaterialDialog mMaterialDialog = new MaterialDialog(this)
  .setTitle("MaterialDialog")
  .setMessage("Hello world!")
  .setPositiveButton("OK", new View.OnClickListener() {

@Override

public void onClick(View v) {

 mMaterialDialog.dismiss();

 ...

}

  
}
)
  .setNegativeButton("CANCEL", new View.OnClickListener() {

@Override

public void onClick(View v) {

 mMaterialDialog.dismiss();

 ...

}

  
}
);
  mMaterialDialog.show();
  // You can change the message anytime. before show mMaterialDialog.setTitle("??");
 mMaterialDialog.show();
 // You can change the message anytime. after show mMaterialDialog.setMessage("?????~");

With the first initial and mMaterialDialog.show(), it will show automatically.

In addition, you can call setView (View v) & setContentView() to set a View what you like or custom after the instantiation. This replaces the title and message.

EditText contentView = new EditText(this);
 MaterialDialog mMaterialDialog = new MaterialDialog(this).setView(contentView);
  mMaterialDialog.show();

And, you can call setBackgroundResource(int resId) or setBackground(Drawable drawable) to change the background:

mMaterialDialog.setBackgroundResource(R.drawable.background);

1.2.8

  • Fix the problem of soft keyboard repeat display
  • Fix the action buttons became dismiss when scroll view height is too long.
  • Add get buttons so that you can custom them.
  • Update the versions of gradle and some build tools.

1.2.1

  • Now, It has been able to run perfectly on L.
  • Fix the button style on L.
  • Fix the problem, so that it can correctly use AutoCompleteTextView & EditText.

1.1.0

  • Fix the keyboard/input bug when more show.

1.0.9

  • If title is null, no show it, but I think it is ugly without title...;
  • Add set Button's text by string resId, e.g. setPositiveButton(android.R.string.yes, new View.OnClickListener()

1.0.8

  • Add every method return this

1.0.7

  • Fix the BUG of Can not show soft keyboard automatically when focus is on an EditText.
  • Add setCanceledOnTouchOutside() // You should set it before show(), otherwise, it can't take effect.
  • Add setContentView()
  • Add Button press style;
  • ...

I recently was too busy, if you have any Suggestions for the library, I encourage you to read the source code, and try to achieve your requirements, and then I'll merger it. We create good world together.

BUG

DEMO

demo apk v1.2.8

About me

I am a student in China, I love reading pure literature, love Japanese culture and Hongkong music. At the same time, I am also obsessed with writing code. If you have any questions or want to make friends with me, you can write to me: [email protected]

In addition, my blog: http://drakeet.me

If you like my open source projects, you can follow me: https://github.com/drakeet

License

Copyright 2014 drakeet  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Showcase application of SQLDelight and SQLBrite working together based on SQLBrite's sample.

It is a lightweight library which helps to create a custom view.

Nice and simple customizable implementation of Google style up/down arrow.

WindView is an Android Library to show Weather's Wind & pressure Status.

A small routing library for Android with easy back button management and code generation to write less code.

A PhotoView to scale image and finish activity.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes