how to use PercentRelativeLayout in older API Levels?

40 Views Asked by At

I am writing here because I have a huge problem: I developed a quite big app for Android using PercentRelativeLayout everywhere (I know that now it is deprecated but it was not when I've done the project and I cannot rewrite it all).

I've tried the application in multiple devices and it works perfectly, but unfortunately when I tried it on a device running Lollipop 5.1.1 I discovered that all the views using percent values are not shown.

Then, I decided to trying the application on different emulators using Android Studio and I discovered that only devices having API >= 25 render these views.

This is my build.gradle content:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25 
    defaultConfig {
        applicationId "com.zone.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:cardview-v7:25.1.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    testCompile 'junit:junit:4.12'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:percent:25.0.1'
    implementation files('libs/json-simple-1.1.1.jar')
    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.eyalbira.loadingdots:loading-dots:1.0.2'
    compile 'com.google.android.gms:play-services-ads:9.4.0'
}

If any of you knows how to make it working even on older APIs, please tell me.

Thanks in advance.

0

There are 0 best solutions below