图书馆无法在Nougat上使用(API级别24)

时间:2018-07-26 06:14:02

标签: android

我在compile 'com.sdsmdg.harjot:rotatingtext:1.0.2'应用中使用了Android。它适用于Android Marshmallow API 22及更低版本。更精确地说,它使用Animation旋转文本。在AndroidApi level 22和情人中,它显示的文字是Animation。但是更高版本不支持。我应该怎么做才能在所有版本的Android设备上受支持。请帮忙。 这是源代码: MainActivity.java

package com.example.abdusoli.rotatingtext;

import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.animation.BounceInterpolator;
import android.widget.Button;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;

import com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper;
import com.sdsmdg.harjot.rotatingtext.models.Rotatable;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {


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

        Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Raleway-Light.ttf");
        Typeface typeface2 = Typeface.createFromAsset(getAssets(), "fonts/Reckoner_Bold.ttf");

        RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);
        rotatingTextWrapper.setSize(35);
        rotatingTextWrapper.setTypeface(typeface2);

        Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 2000, " ", "Word01", "Word02");
        rotatable.setSize(35);
        rotatable.setAnimationDuration(600);
        rotatable.setTypeface(typeface);
        rotatable.setInterpolator(new BounceInterpolator());

        rotatingTextWrapper.setContent("This is ?", rotatable);

    }

}

gradle.build(模块:应用)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.abdusoli.rotatingtext"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.+'
    compile 'com.flaviofaria:kenburnsview:1.0.7'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.sdsmdg.harjot:rotatingtext:1.0.2'
}

1 个答案:

答案 0 :(得分:1)

当前该库不支持更高版本

Issue has been raised on the repo in github