Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
277 views
in Technique[技术] by (71.8m points)

"android:elevation=" doesn't work on devices pre-Lollipop with compile API21

I'm trying to use "android: elevation =" in my application but once I run it does not appear in the device with android 4.1.2

gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.alvaro.proyectocaronte"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

layout.xml

<RelativeLayout
                android:layout_width="1100dp"
                android:layout_height="fill_parent"
                android:background="@drawable/rounded_corner"
                android:layout_alignParentTop="true"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:layout_marginRight="93dp"
                android:layout_marginEnd="93dp"
                android:elevation="3dp"/>

maybe I'm not compiling correctly Lollipop for pre-lollipop devices, Any suggestions?

If you need to see other parts of the code, I'll edit the question

Thanks

question from:https://stackoverflow.com/questions/27693843/androidelevation-doesnt-work-on-devices-pre-lollipop-with-compile-api21

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Elevation requires the device to run Lollipop. See this answer on how to simulate elevation https://stackoverflow.com/a/26747592/680249


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...