<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/reportTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/reportHeading"
android:layout_centerHorizontal="true"
android:layout_marginTop="49dp"
android:background="@color/lavenderlush"
android:gravity="center"
android:stretchColumns="1in" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|fill" >
<TextView
android:id="@+id/serialNoHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:layout_gravity="center_horizontal"/>
.
.
.
.
Java文件。: -
serialNoHeading.setTextColor(getResources().getColor(R.color.blue));
descrepancyTitleHeading.setTextColor(getResources().getColor(R.color.blue));
discrepancyTypeHeading.setTextColor(getResources().getColor(R.color.blue));
discrepancyStatusHeading.setTextColor(getResources().getColor(R.color.blue));
defectCountHeading.setTextColor(getResources().getColor(R.color.blue));
TableLayout reportTable = (TableLayout) findViewById(R.id.reportTable);
与上面的declerations一样,在colors.xml中声明了蓝色 reportTable,serialNoHeading也被声明如图所示。然而,所有这些都突然产生错误。无法找到ID!这些天都在工作。