これはXMLの質問かAndroidの質問か分かりません。私は異なるレイアウトで繰り返されるXMLの構造を持っているので、それを抽出してそれを独自のファイルに保存します。これには、TableLayoutの3行が含まれています。私はXMLファイルにエラーが発生しています。どんな考え?それは外部のXMLレイアウトがないからです。AndroidレイアウトのXMLファイルに行のみを含めることはできますか?
ありがとうございます!
これは新しいxmlファイルの内容です。これを後で(レイアウトを使用して)メインレイアウトファイルに挿入します。
<?xml version="1.0" encoding="utf-8"?>
<TableRow
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center_vertical">
<Button
android:id="@+id/button_calc"
android:layout_column="1"
android:layout_span="2" />
</TableRow>
<TableRow android:gravity="center_vertical">
<TextView
android:textColor="@color/black"
android:id="@+id/title_res"
android:layout_column="1"
android:padding="5dp" />
<TextView
android:textColor="@color/black"
android:id="@+id/res"
android:layout_column="1"
android:textSize="25dp" />
</TableRow>
<TableRow android:gravity="center_vertical">
<TextView
android:id="@+id/title_res_etc"
android:textColor="@color/black"
android:layout_column="1"
android:paddingLeft="5dp"
android:layout_span="2" />
</TableRow>
このファイルをどのように参照していますか? http://developer.android.com/training/improving-layouts/reusing-layouts.htmlも読んでください。 – Jack