2014-09-27 83 views
1

我在寻找这里提到的RippleDrawable的源代码https://developer.android.com/preview/material/animations.html#touchRippleDrawable的源代码在哪里? (Android L)

实际上,它必须退出,因为它在Android L中用于涟漪动画。

但是,也许这是我的错,我没能找到它...

感谢您的帮助。

这是我发现解压android.jar: - (((

public class RippleDrawable extends LayerDrawable 
{ 
public RippleDrawable(Drawable content, Drawable mask) 
{ 
super((Drawable[])null); throw new RuntimeException("Stub!"); } 
public void setAlpha(int alpha) { throw new RuntimeException("Stub!"); } 
public void setColorFilter(ColorFilter cf) { throw new RuntimeException("Stub!"); } 
public int getOpacity() { throw new RuntimeException("Stub!"); } 
protected boolean onStateChange(int[] stateSet) { throw new RuntimeException("Stub!"); } 
protected void onBoundsChange(Rect bounds) { throw new RuntimeException("Stub!"); } 
public boolean setVisible(boolean visible, boolean restart) { throw new RuntimeException("Stub!"); } 
public boolean isStateful() { throw new RuntimeException("Stub!"); } 
public void setColor(ColorStateList color) { throw new RuntimeException("Stub!"); } 
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme) throws XmlPullParserException, IOException { throw new RuntimeException("Stub!"); } 
public boolean setDrawableByLayerId(int id, Drawable drawable) { throw new RuntimeException("Stub!"); } 
public void setPaddingMode(int mode) { throw new RuntimeException("Stub!"); } 
public void applyTheme(Resources.Theme t) { throw new RuntimeException("Stub!"); } 
public boolean canApplyTheme() { throw new RuntimeException("Stub!"); } 
public void setHotspot(float x, float y) { throw new RuntimeException("Stub!"); } 
public void setHotspotBounds(int left, int top, int right, int bottom) { throw new RuntimeException("Stub!"); } 
public void draw(Canvas canvas) { throw new RuntimeException("Stub!"); } 
public Rect getDirtyBounds() { throw new RuntimeException("Stub!"); } 
public Drawable.ConstantState getConstantState() { throw new RuntimeException("Stub!");  } 

} 
+1

您是否已经通过Android SDK Manager下载了Android L源代码,在您的PC上拉链(例如7-zip)Android L目录,然后在压缩文件中搜索RippleDrawable类?只是想知道... – ChuongPham 2014-09-27 14:33:27

+0

@ChuongPham我做到了,请参阅我的编辑 – 2014-09-27 14:42:30

+1

好吧,现在就清除它。是的,'RippleDrawable'类被导出到'android.jar',但在Android L的源代码中没有相应的文档。但是,当我搜索[RippleDrawable](http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#q=RippleDrawable)时,没有任何迹象表明这个类的用法。我猜Google要么错过了某些东西,要么因为Android L仍然处于预览模式,他们没有提供正式的文档 - 在源代码和/或在线http://developer.android.com/。 – ChuongPham 2014-09-27 14:59:22

回答

3

要理解这是如何工作的,你需要单独的,在你的头上,构建和运行环境

为了。为了构建你的程序,你只需要针对Android API的定义构建.Google发布的android.jar仅包含定义API的存根。例如,API库中有很多公共方法,它们标记为“@hide”注释。这些方法不会放在android.jar中二。另外,正如您已经注意到的,大多数方法的主体只是抛出运行时异常。

android.jar文件不是您的应用程序的一部分。在运行时,您的应用程序会绑定到安装在手机上的真实Android库。它包括各种API方法的实际实现。

在运行时可用的代码可在AOSP项目中找到。

不幸的是,谷歌还没有放弃L码。缺少将Android库从支持L的设备中拉出并解除编译的问题,无法查看代码RippleDrawable

无赖!