AndroidStudio开发之后,发现确实是一款开发神器。但唯一一点就是没有给我关联到源码,每次看到的都是这种情况。
throw new RuntimeException("Stub!")下面说下我如何解决的。
第一步:首先进入C盘找到\Users\用户名\.AndroidStudio2.0\config\options这个目录,在里面找到这个文件jdk.table.xml
文件,
<jdk version="2"> <name value="Android API 26 Platform" /> <type value="Android SDK" /> <homePath value="D:\android\sdk" /> <roots> <annotationsPath> <root type="composite"> <root type="simple" url="jar://$APPLICATION_HOME_DIR$/plugins/android/lib/androidAnnotations.jar!/" /> </root> </annotationsPath> <classPath> <root type="composite"> <root type="simple" url="jar://D:/android/sdk/platforms/android-26/android.jar!/" /> <root type="simple" url="file://D:/android/sdk/platforms/android-26/data/res" /> </root> </classPath> <javadocPath> <root type="composite"> <root type="simple" url="http://developer.android.com/reference/" /> </root> </javadocPath> <sourcePath> <root type="composite"> <root type="simple" url="file://D:/android/sdk/sources/android-25" /> </root> </sourcePath> </roots> <additional jdk="1.8 (1)" sdk="android-26" /> </jdk> </component></application>第二步 :
更改红色文字部分 ,找到<sourcePath>标签,并在下面添加如图所示的一行,把自己源码路径 替换为file后面那一串。
第三步:
重新启动android studio。查看源码
效果如下:
*/
public class TableLayout extends LinearLayout {
private int[] mMaxWidths;
private SparseBooleanArray mStretchableColumns;
private SparseBooleanArray mShrinkableColumns;
private SparseBooleanArray mCollapsedColumns;
private boolean mShrinkAllColumns;
private boolean mStretchAllColumns;
private TableLayout.PassThroughHierarchyChangeListener mPassThroughListener;
private boolean mInitialized;
/**
* <p>Creates a new TableLayout for the given context.</p>
*
* @param context the application environment
*/
public TableLayout(Context context) {
super(context);
initTableLayout();
}
/**
* <p>Creates a new TableLayout for the given context and with the
* specified set attributes.</p>
*
* @param context the application environment
* @param attrs a collection of attributes
*/
public TableLayout(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TableLayout);
String stretchedColumns = a.getString(R.styleable.TableLayout_stretchColumns);
if (stretchedColumns != null) {
if (stretchedColumns.charAt(0) == '*') {
mStretchAllColumns = true;
} else {
mStretchableColumns = parseColumns(stretchedColumns);
}
}
String shrinkedColumns = a.getString(R.styleable.TableLayout_shrinkColumns);
if (shrinkedColumns != null) {
if (shrinkedColumns.charAt(0) == '*') {
mShrinkAllColumns = true;
} else {
mShrinkableColumns = parseColumns(shrinkedColumns);
}
}
String collapsedColumns = a.getString(R.styleable.TableLayout_collapseColumns);
if (collapsedColumns != null) {
mCollapsedColumns = parseColumns(collapsedColumns);
}
a.recycle();
initTableLayout();
}
引用 http://blog.csdn.net/wuqilianga/article/details/54346103