爬坑小王子——Android Studio集成漂亮Sweet Alert Dialog

xiaoxiao2021-02-28  127

作为一个专门坑蒙拐骗的程序员,你必须拥有一颗爬坑的心态,不然你别想在网络的世界里生存下去。当然了,像我这样的坑货写这篇文章只是为了记录下

Sweet Alert Dialog

的集成和使用 至于原因吗?很简单,就是怕以后忘记了或者说可以快捷的使用它。当然了感谢大神提供的框架。看完了你就真的了,这个还是蛮好集成的。废话不多说了,现在就开始吧!Go Go Go github:点击打开链接 第一步: 你不需要去GitHub上下载什么jar,Dome的了,因为Google已经为我们做好了准备好了的。 复制: sweetalert:library:1.3 打开你的Android Studio 然后 恭喜你,到这里你就已经将SweetAlertDialog 集成到你的项目中了,但是,当AS build完后,你会发现,TM的居然报错了。没关系,这不是才第一步吗,俗话说得好,事不过三吗? 第二步:

修改AndroidManifest.xml:

在manifest添加 xmlns:tools=”http://schemas.android.com/tools”

在application添加 tools:replace=”android:icon,android:theme,android:allowBackup,android:label,android:supportsRtl”

将在application中所用到的全部android:都在上面tools:replace=添加进去,逗号分隔。

如下:

<?xml version= "1.0" encoding= "utf-8" ?> <manifest xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" package = "cn.cgrs.myalert" > <application tools:replace= "android:allowBackup,android:icon,android:label,android:supportsRtl,android:theme" android:allowBackup= "true" android:icon= "@mipmap/ic_launcher" android:label= "@string/app_name" android:supportsRtl= "true" android:theme= "@style/AppTheme" > <activity android:name= ".MainActivity" > <intent-filter> <action android:name= "android.intent.action.MAIN" /> <category android:name= "android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

没错,就这样完了,漂亮飘逸的提示信息就出来了!至于效果如何,我就不演示了!谁用谁做的。。。。

菜B一枚,请轻喷。。。

转载请注明原文地址: https://www.6miu.com/read-19767.html

最新回复(0)