Sei sulla pagina 1di 9

dialogplus (/details/1/1413)

 4069 (https://github.com/orhanobut/dialogplus/stargazers?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=1413)  139

(https://github.com/orhanobut/dialogplus/watchers?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=1413)  696

(https://github.com/orhanobut/dialogplus/network?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=1413)  28

(https://github.com/orhanobut/dialogplus/issues?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=1413)

 (https://facebook.com/sharer.php?
General u=https://android-
Category
arsenal.com/details/1/1413)
Free (/free)

Tag
 (https://twitter.com/intent/twe
arsenal.com/details/1/1413&text=The%20An
Dialogs (/tag/30)

License %20Dialogs%20-%20dialogplus
Apache License, Version 2.0 (http://opensource.org/licenses/Apache-2.0?utm_source=android-arsenal.co

 (http://news.ycombinator.com/submitlink
m&utm_medium=referral&utm_campaign=1413)

arsenal.com/details/1/1413&t=The%20Andro
Min SDK
10 (Android 2.3.3–2.3.7 Gingerbread) (/api?level=10)

Registered
%20Dialogs%
Jan 20, 2015

Favorites
 (https://plus.google.com/share?
24 url=https://android-
Link arsenal.com/details/1/1413)
https://github.com/orhanobut/dialogplus (https://github.com/orhanobut/dialogplus?utm_source=android-ar

 (https://reddit.com/subm
senal.com&utm_medium=referral&utm_campaign=1413)

arsenal.com/details/1/1413&title=The%20An
See also
AwesomeDialog (/details/1/6109)
Bottom Dialog (/details/1/3168) %20Dialog
CircularDialogs (/details/1/6485)
HeaderDialog (/details/1/5076)
LovelyDialog (/details/1/3452)

Additional

Language
Java

Version
1.11 (Jan 31, 2016) (https://github.com/orhanobut/dialogplus/releases/tag/1.11?utm_source=android-arse
nal.com&utm_medium=referral&utm_campaign=1413)

Created
Dec 12, 2014

Updated
May 7, 2018

Owner
Orhan Obut (orhanobut) (/user/orhanobut)

Contributors
10 (https://github.com/orhanobut/dialogplus/graphs/contributors?utm_source=android-arsenal.com&utm_
medium=referral&utm_campaign=1413)

Activity

Badge
 Generate

Download
 Source code
 APK file

Announcement
¡FELICIDADES!
USUARIO 1.000.000
Nuestro sistema aleatorio de
selección de ganadores podría
elegirte como ganador de un
SMARTPHONE
ONLINE: 16/09/2018 14:55

CLICA AQUI
©fabricadepremios

     

Android Arsenal dialogplus (https://android-arsenal.com/details/1/1413) API 10+ (https://android-


arsenal.com/api?level=10) gitter join chat (https://gitter.im/orhanobut/dialogplus?
utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=1413)

(https://github.com/orhanobut/dialogplus/blob/master/art/DP1.png?
utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)

DialogPlus

Simple and advanced dialog solution.

Uses normal view as dialog


Provides expandable option
Multiple positioning
Built-in options for easy implementation
(https://github.com/nr4bt/dialogplus/blob/master/art/dialogplus.gif?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)

(https://github.com/nr4bt/dialogplus/blob/master/art/dialogplusanim.gif?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)

DialogPlus provides android L dialog animation

DialogPlus provides 3 position:

Top : Dialog will appear at top with animation


Center : Dialog will appear in the center with animation
Bottom : Dialog will appear at the bottom of the screen with animation
DialogPlus provides 3 content types:

ListHolder : Items will be shown in a listview


GridHolder : Items will be shown in a gridview
ViewHolder : Your customized view will be shown in the content

Gradle

implementation 'com.orhanobut:dialogplus:1.11@aar'

Usage
Use the builder to create the dialog.

Basic usage

DialogPlus dialog = DialogPlus.newDialog(this)


.setAdapter(adapter)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
}
})
.setExpanded(true) // This will enable the expand feature, (similar to android L share d
.create();
dialog.show();

More options
Enable expand animation same as Android L share dialog

.setExpanded(true) // default is false, only works for grid and list

Set expand animation default height

.setExpanded(true, 300)

Select different holder.

Use ListView as content holder, note that this is default content type.

setContentHolder(new ListHolder())
Use ViewHolder as content holder if you want to use a custom view for your dialog. Pass
resource id

.setContentHolder(new ViewHolder(R.layout.content))

or pass view itself

.setContentHolder(new ViewHolder(view))

Use GridHolder if you want to use GridView for the dialog. You must set column number.

.setContentHolder(new GridHolder(COLUMN_NUMBER))

Get the holder view, ListView, GridView or your custom view

View view = dialogPlus.getHolderView();

Set dialog position. BOTTOM (default), TOP or CENTER. You can also combine other Gravity
options.

.setGravity(Gravity.CENTER)

Define if the dialog is cancelable and should be closed when back pressed or out of dialog is
clicked

.setCancelable(true)

Set Adapter, this adapter will be used to fill the content for ListHolder and GridHolder. This is
required if the content holder is ListHolder or GridHolder. It is not required if the content holder
is ViewHolder.

.setAdapter(adapter);

Set an item click listener when list or grid holder is chosen. In that way you can have callbacks
when one of your items is clicked

.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
}
})
Set a global click listener to you dialog in order to handle all the possible click events. You can
then identify the view by using its id and handle the correct behaviour. Only views which has id
will trigger this event.

.setOnClickListener(new OnClickListener() {
@Override
public void onClick(DialogPlus dialog, View view) {

}
})

Add margins to your dialog. They are set to 0 except when gravity is center. In that case basic
margins are applied

.setMargin(left, top, right, bottom)

Set padding to the holder

.setPadding(left, top, right, bottom)

Set the footer view using the id of the layout resource

.setFooter(R.layout.footer)

or use view

.setFooter(view)

Get the footer view

View view = dialogPlus.getFooterView();

Set the header view using the id of the layout resource

.setHeader(R.layout.header)

or use view

.setHeader(view)

Get the header view


View view = dialogPlus.getHeaderView();

Set animation resources

.setInAnimation(R.anim.abc_fade_in)
.setOutAnimation(R.anim.abc_fade_out)

Set width and height for the content

.setContentWidth(ViewGroup.LayoutParams.WRAP_CONTENT) // or any custom width ie: 300


.setContentHeight(ViewGroup.LayoutParams.WRAP_CONTENT)

Dismiss Listener, triggered when the dialog is dismissed

.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogPlus dialog) {

}
})

Cancel Listener, triggered when the dialog is cancelled by back button or clicking outside

.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogPlus dialog) {

}
})

BackPress Listener, triggered when the back button is pressed

.setOnBackPressListener(new OnBackPressListener() {
@Override
public void onBackPressed(DialogPlus dialog) {

}
})

Change content container background, as default white

.setContentBackgroundResource(resource)

Change overlay container background, as default it's semi-transparent black


.setOverlayBackgroundResource(resource)

License

Copyright 2016 Orhan Obut

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.

Follow us on Twitter (https://twitter.com/Android_Arsenal?utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=1413)

Read us in Telegram (https://telegram.me/AndroidArsenal?utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=1413)

Get Android app on Google Play (https://play.google.com/store/apps/details?


id=com.android_arsenal.androidarsenal&utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)

Stay informed with Pushbullet (https://www.pushbullet.com/channel?tag=android_arsenal&utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=1413)

Created by Vladislav Bauer (https://github.com/vbauer?utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=1413)
 (https://twitter.com/BauerVlad?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)
 (https://www.linkedin.com/in/vladislavbauer?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)
 (https://www.paypal.me/VladislavBauer?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=1413)
© 2014-2018 - Android Arsenal (/) | Privacy (/privacy)

Potrebbero piacerti anche