2014-09-27 78 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

無賴!