3.QMUI---QDTipDialog的用法

1. 引入库

1.最新的库会上传到 JCenter 仓库上,请确保配置了 JCenter 仓库源,然后直接引用:

compile 'com.qmuiteam:qmui:1.0.6'
至此,QMUI 已被引入项目中。

2.需要引用QMUI的样式

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

<style name="AppTheme" parent="QMUI.Compat.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

2.QDTipDialog的用法

1.Loading类型提示框
QMUITipDialog tipDialog= new QMUITipDialog.Builder(getContext())
        .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
        .setTipWord("正在加载")
        .create();
tipDialog.show();   
tipDialog.dismiss();
2.成功提示类型提示框
QMUITipDialog tipDialog= new QMUITipDialog.Builder(getContext())
        .setIconType(QMUITipDialog.Builder.ICON_TYPE_SUCCESS)
        .setTipWord("发送成功")
        .create();
tipDialog.show();                                            
tipDialog.dismiss();
3.失败提示类型提示框
QMUITipDialog tipDialog= new QMUITipDialog.Builder(getContext())
        .setIconType(QMUITipDialog.Builder.ICON_TYPE_FAIL)
        .setTipWord("发送失败")
        .create();
tipDialog.show();
 tipDialog.dismiss();
4.信息提示类型提示框
QMUITipDialog tipDialog= new QMUITipDialog.Builder(getContext())
        .setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
        .setTipWord("请勿重复操作")
        .create();
tipDialog.show();
tipDialog.dismiss();
5.单独图片提示类型提示框
QMUITipDialog tipDialog= new QMUITipDialog.Builder(getContext())
        .setIconType(QMUITipDialog.Builder.ICON_TYPE_SUCCESS)
        .create();
tipDialog.show();
tipDialog.dismiss();
6.单独图片提示类型提示框
QMUITipDialog tipDialog= new QMUITipDialog.Builder(getContext())
        .setTipWord("请勿重复操作")
        .create();
tipDialog.show(); 
tipDialog.dismiss();
7.自定义内容提示框
QMUITipDialog tipDialog= new QMUITipDialog.CustomBuilder(getContext())
        .setContent(R.layout.tipdialog_custom)
        .create();
tipDialog.show(); 
tipDialog.dismiss();
tipdialog_custom.xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:orientation="horizontal"
              tools:ignore="UseCompoundDrawables">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="自定义 icon"
        android:src="@drawable/qmui_icon_notify_info"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:text="自定义结构"
        android:textColor="@color/qmui_config_color_white"
        android:textSize="16sp"/>

</LinearLayout>








阅读更多
个人分类: QMUI
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭