sweet-alert-dialog在在android studio应用问题说明

看到这个sweet-alert-dialog很亲切,因为前端开发本人用的提示就是这个js插件,java牛人很厉害,直接弄成一个java包插件,Good!
下面记录如何引用到工程,并使用:
sweet-alert-dialog插件可以直接到github上下载
地址:https://github.com/pedant/sweet-alert-dialog
或者直接到发布好的页面下载:
https://github.com/pedant/sweet-alert-dialog/releases
我下载的是:sweet-alert-dialog-1.1版本zip包
将下载sweet-alert-dialog-1.1包解压出来,再你的app项目中,打开 File -> New -> Import Module 选择到刚才解压的文件夹
这里写图片描述
这里写图片描述
引用sweet-alert-dialog

报错:
Error:Dependency Myalert:sweetalertdialog:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: D:\AndroidStudioProjects\TEST\Myalert\sweetalertdialog\build\outputs\apk\sweetalertdialog-release-unsigned.apk
可以先Build一下sweet-alert-dialog工程。

另外你的工程Gradle Scripts目录下的bulid.gradle (Module:app)下
dependencies {
compile fileTree(include: [‘*.jar’], dir: ‘libs’)
testCompile ‘junit:junit:4.12’
compile ‘com.android.support:appcompat-v7:24.1.1’
compile ‘cn.pedant.sweetalert:library:1.3’
}
引入:compile ‘cn.pedant.sweetalert:library:1.3’

Build app出现新的错误信息:
Error:Execution failed for task ‘:app:processDebugManifest’.

Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).
Suggestion: add ‘tools:replace=”android:icon”’ to element at AndroidManifest.xml:5:5-18:19 to override.

解决方法:
修改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>

到此sweet-alert-dialog已完成配置,可以开始随意使用了….

基于谷歌官方提供的3D翻转示例进行修改,修复了在不同设备上显示效果差异过大的问题。项目地址:https://github.com/GcsSloop/Rotate3dAnimation 效果图:如何使用:// 计算中心点(这里是使用view的中心作为旋转的中心点)         final float centerX = view.getWidth() / 2.0f;                 final float centerY = view.getHeight() / 2.0f;        //括号内参数分别为(上下文,开始角度,结束角度,x轴中心点,y轴中心点,深度,是否扭曲)         final Rotate3dAnimation rotation = new Rotate3dAnimation(this, start, end, centerX, centerY, 1.0f, true);         rotation.setDuration(1500);                               //设置动画时长         rotation.setFillAfter(true);                              //保持旋转后效果         rotation.setInterpolator(new AccelerateInterpolator());   //设置插值器         rotation.setAnimationListener(new AnimationListener() {   //设置监听器             @Override             public void onAnimationStart(Animation animation) {             }            @Override             public void onAnimationRepeat(Animation animation) {             }            @Override             public void onAnimationEnd(Animation animation) {             }         });         view.startAnimation(rotation);                            //开始动画
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT流渊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值