am a58d78ec: am 9cca3c83: am a262144d: Add ViewCompatUtils.setElevation
* commit 'a58d78ec896b0d8bb80e9ab028af8766defd0261': Add ViewCompatUtils.setElevationmain
commit
c83113bbc1
|
@ -31,6 +31,9 @@ public final class ViewCompatUtils {
|
||||||
private static final Method METHOD_setPaddingRelative = CompatUtils.getMethod(
|
private static final Method METHOD_setPaddingRelative = CompatUtils.getMethod(
|
||||||
View.class, "setPaddingRelative",
|
View.class, "setPaddingRelative",
|
||||||
int.class, int.class, int.class, int.class);
|
int.class, int.class, int.class, int.class);
|
||||||
|
// Note that View.setElevation(float) has been introduced in API level 21.
|
||||||
|
private static final Method METHOD_setElevation = CompatUtils.getMethod(
|
||||||
|
View.class, "setElevation", float.class);
|
||||||
|
|
||||||
private ViewCompatUtils() {
|
private ViewCompatUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
|
@ -51,4 +54,11 @@ public final class ViewCompatUtils {
|
||||||
}
|
}
|
||||||
CompatUtils.invoke(view, null, METHOD_setPaddingRelative, start, top, end, bottom);
|
CompatUtils.invoke(view, null, METHOD_setPaddingRelative, start, top, end, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setElevation(final View view, final float elevation) {
|
||||||
|
if (METHOD_setElevation == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CompatUtils.invoke(view, null, METHOD_setElevation, elevation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue