ubuntu10.04
eclispe3.5.2
Adt:Android2.3.3
Android源码:android-2.3.3_r1-sources
例如,Ctrl + 鼠标点击Button,打开Button的源码,显示如下:
每个函数占一行,整个函数都没有换行。
package android.widget;
@android.widget.RemoteViews.RemoteView()
public class Button
  extends android.widget.TextView
{
public  Button(android.content.Context context) { super((android.content.Context)null,(android.util.AttributeSet)null,0); throw new RuntimeException("Stub!"); }
public  Button(android.content.Context context, android.util.AttributeSet attrs) { super((android.content.Context)null,(android.util.AttributeSet)null,0); throw new RuntimeException("Stub!"); }
public  Button(android.content.Context context, android.util.AttributeSet attrs, int defStyle) { super((android.content.Context)null,(android.util.AttributeSet)null,0); throw new RuntimeException("Stub!"); }
}
原因何在?

解决方案 »

  1.   

    上面我是用
    在Eclipse里关联Android源码的简单办法
    这个方法设置,不知道是不是下载的源码太小的缘故,只有8.7M
    源码是从http://grepcode.com/snapshot/repository.grepcode.com/java/ext/com.google.android/android/2.3.3_r1下载的。现在又重新下载了一个源码。http://lizongbo.googlecode.com/files/android_gingerbread_javasrc.zip,33.7M,比上一个大了近30M.
    按照以下方法设置后就ok了,关联的源码包含了注释,也能正常换行。
    4.开始进行关联Android的源代码,在Eclipse中新建一个Android工程,选中工程,主菜单 –>Project–>Properties–>选择Android,Project Build Target选中Android 2.3。
    然后再点左边的“Java Build Path”,切换到 Libraries 面板,展开 Android2.3 这个lib,点击android.jar的Source attachment,再点Edit.在对话框中点“External File”,选择E:/Java/android/javasrc/android_gingerbread_javasrc.zip,点OK进行确认。这样就把Android的java代码关联好了。
    http://618119.com/archives/2011/01/01/201.html
      

  2.   

    android源码里面没有sdk源码吗?
      

  3.   

    各版本的api源码列表
    http://code.google.com/p/lizongbo/downloads/list
      

  4.   

    可以从源码的以下目录找到共有的API:
    公有SDK源码可以在这里找到:mydroid/frameworks/base/core/java。在 那个文件夹下,你可以找到一个Android目录,它应该被拷贝到你的Android SDK 安装目录下的源码目录
    http://hi.baidu.com/redtramp/blog/item/a9b5c38803a53584a5c272ff.html/cmtid/acfa254e83805ec4d0c86afa