项目作者: Peter1303

项目描述 :
仿Windows Phone的对话框
高级语言: Java
项目地址: git://github.com/Peter1303/WPDialog.git
创建时间: 2016-08-07T12:36:12Z
项目社区:https://github.com/Peter1303/WPDialog

开源协议:

下载


WPDialog

仿Windows Phone的对话框

==========








Demo下载

这个WPDialog有以下特点:
  • 极简而且体积小
  • 仿Windows Phone 10风格
  • 默认雅黑主题,当然,还有简洁白主题
  • 可以自定义View
  • 可在顶部显示

Gradle

  1. compile 'com.widget.WPDialog'

使用方法:
普通例子:

  1. final WPDialog wp=new WPDialog(this);
  2. wp.setTitle(titlte)
  3. .setMessage(message)
  4. .setPositiveButton(ok, new OnClickListener(){
  5. @Override
  6. public void onClick(View p1)
  7. {
  8. wp.dismiss();
  9. }
  10. })
  11. .setNeutralButton(neutral, new OnClickListener(){
  12. @Override
  13. public void onClick(View p1)
  14. {
  15. wp.dismiss();
  16. }
  17. })
  18. .setNegativeButton(cancel, new OnClickListener(){
  19. @Override
  20. public void onClick(View p1)
  21. {
  22. wp.dismiss();
  23. }
  24. })
  25. .show();

如果只需要单个按钮,你可以不创建该按钮的监听事件或者:

  1. wp.setPositiveButton(“”, new OnClickListener(){
  2. @Override
  3. public void onClick(View p1)
  4. {
  5. wp.dismiss();
  6. }
  7. });

添加View只需要:

  1. wp.setView(view);

在顶部显示只需要:

  1. wp.setTopDialog(true);

设置简洁白主题:

  1. wp.setLightTheme();

设置标题:

  1. wp.setTitle(titlte);

设置内容:

  1. wp.setMessage(message);

设置“确定”按钮:

  1. wp.setPositiveButton(ok, new OnClickListener(){
  2. @Override
  3. public void onClick(View p1)
  4. {
  5. wp.dismiss();
  6. }
  7. });

设置“中间”按钮:

  1. wp.setNeutralButton(neutral, new OnClickListener(){
  2. @Override
  3. public void onClick(View p1)
  4. {
  5. wp.dismiss();
  6. }
  7. });

设置“取消”按钮:

  1. wp.setNegativeButton(cancel, new OnClickListener(){
  2. @Override
  3. public void onClick(View p1)
  4. {
  5. wp.dismiss();
  6. }
  7. });

Dismiss方法:

  1. wp.dismiss();

设置Dismiss监听方法:

  1. wp.setOnDismissListener(new DialogInterface.OnDismissListener(){});

设置不可取消:

  1. wp.setCancelable(false)

License

  1. Copyright 2016 Peter&DevelopTeam
  2.  
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6.  
  7. http://www.apache.org/licenses/LICENSE-2.0
  8.  
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.