Пульсация пульса / пульс анимация Lib не работает - PullRequest
0 голосов
/ 06 января 2020

Я хочу использовать pulseLayout В моем проекте, но он не работает. Я сделал демонстрационный проект для выяснения причины, по которому он ничего не смог сделать. Я пробовал 2 импульса, но ни один из них не работает. Доступны следующие файлы: https://github.com/gaurav414u/android-ripple-pulse-animation

https://github.com/booncol/Pulsator4Droid

Файл макета:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:ripple="http://schemas.android.com/tools"
    tools:context=".MainActivity">

    <com.gauravbhola.ripplepulsebackground.RipplePulseLayout
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:clipChildren="false"
        ripple:rippleColor="#3D66C7"
        ripple:rippleType="stroke"
        ripple:strokeWidth="2dp"
        ripple:startRadius="42dp"
        android:layout_centerInParent="true"
        ripple:endRadius="100dp"
        ripple:duration="2000"
        android:id="@+id/layout_ripplepulse">
    </com.gauravbhola.ripplepulsebackground.RipplePulseLayout>


    <pl.bclogic.pulsator4droid.library.PulsatorLayout
        android:id="@+id/pulsator"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:pulse_count="4"
        app:pulse_duration="7000"
        app:pulse_repeat="0"
        android:layout_below="@+id/layout_ripplepulse"
        app:pulse_color="@color/colorAccent"
        app:pulse_startFromScratch="false"
        app:pulse_interpolator="Linear">
    </pl.bclogic.pulsator4droid.library.PulsatorLayout>

</RelativeLayout>

Активность:

public class MainActivity extends AppCompatActivity {

    RipplePulseLayout layout_ripplepulse;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        layout_ripplepulse  =findViewById(R.id.layout_ripplepulse);
        layout_ripplepulse.startRippleAnimation();

    }
}

Уровень приложения Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.trueapps.wordsearchnewproject"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    implementation 'pl.bclogic:pulsator4droid:1.0.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.gauravbhola.ripplepulsebackground:library:1.0.0'

}

Уровень проекта Gradle:

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 Ответ

0 голосов
/ 18 января 2020

В заголовке файла Xml вы используете

xmlns:ripple="http://schemas.android.com/tools"

Просто замените его на

xmlns:ripple="http://schemas.android.com/apk/res-auto"
...