I have the following XML:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="1">
<!-- LinearLayout IDs, first digit denotes day of week (0 Sunday...6 Saturday),
second digit denotes hour of day (0 midnight...23 11pm) -->
<TableRow android:id="@+id/row9" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#C9C9C9">
<LinearLayout android:id="@+id/19" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/29" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/39" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/49" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/59" android:padding="3dip"></LinearLayout>
</TableRow>
<TableRow android:id="@+id/row10" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#9C9C9C">
<LinearLayout android:id="@+id/110" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/210" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/310" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/410" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/510" android:padding="3dip"></LinearLayout>
</TableRow>
<TableRow android:id="@+id/row11" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#C9C9C9">
<LinearLayout android:id="@+id/111" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/211" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/311" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/411" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/511" android:padding="3dip"></LinearLayout>
</TableRow>
<TableRow android:id="@+id/row12" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#9C9C9C">
<LinearLayout android:id="@+id/112" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/212" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/312" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/412" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/512" android:padding="3dip"></LinearLayout>
</TableRow>
<T开发者_运维技巧ableRow android:id="@+id/row13" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#C9C9C9">
<LinearLayout android:id="@+id/113" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/213" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/313" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/413" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/513" android:padding="3dip"></LinearLayout>
</TableRow>
<TableRow android:id="@+id/row14" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#9C9C9C">
<LinearLayout android:id="@+id/114" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/214" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/314" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/414" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/514" android:padding="3dip"></LinearLayout>
</TableRow>
<TableRow android:id="@+id/row15" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#C9C9C9">
<LinearLayout android:id="@+id/115" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/215" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/315" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/415" android:padding="3dip"></LinearLayout>
<LinearLayout android:id="@+id/515" android:padding="3dip"></LinearLayout>
</TableRow>
</TableLayout>
In the code I am trying to get a handle to one of the inner LinearLayouts but none of them appear under
findViewById(R.id.
etc...
All the other elements appear like row9, row10, etc.
Thanks!
it must start with a character
android:id="@+id/Z123"
is valid
android:id="@+id/13"
is not valid and u can't reference it in your code
since the auto generate class R can't create a variable start with a number it's invalid in java
You can assign a personalized ID without viewing the xml to any LinearLayout, just do it in the graphic mode: Right click in the object tree view, and use the context menu ASSIGN ID.
精彩评论