Android L - android.graphics.outline

2019-07-22 04:03发布

问题:

According to the android developer page for the developer preview of L, it's possible to use the Outline class & define outlines for view's to display the shadows in the correct way. (http://developer.android.com/preview/material/views-shadows.html#shadows)

In my case, the "L"-sdk I use, didn't found it. Therefore I couldn't import and use the class.

According to the test project, stored in sdk/samples/android-L/ui/views/Elevation/ElevationDrag this class should be stored in "android.graphics.outline", but even in this project it can't be located correctly.

Is this feature not implemented in the developer preview yet or did I missed something?

回答1:

Finally got it.

It's a bug in android studio. I just added manually the import to my activity:

import android.graphics.Outline

It will be shown as error, but it can compile & run. I hope they will fix this soon.

EDIT: I created an issue here: https://code.google.com/p/android/issues/detail?id=72788&q=android%20studio%20android%20l&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

It looks like, they're working on it.



回答2:

The same problem than you but your answer it didn't work for me, I am trying to import

import android.graphics.outline;

And de output is:

Error:(7, 24) error: cannot find symbol class outline

The build.gradleseems to be well configurated with the compileSdkVersion 'android-L' sentence

** Fixed

the right import is: import android.graphics.Outline;