вот код RelativeLayout RLayout = (RelativeLayout) findViewById (R.id.RelativeLayout); TableRow tableRow = (TableRow) findViewById (R.id.TableRow); for (int i = 1; i <4; i ++) {LayoutInflater inflater = (LayoutInflater) getSystemService (Context.LAYOUT_INFLATER_SERVICE); View inflated = inflater.inflate (R.layout.main, tableRow); } этого недостаточно? я должен использовать новый addview (view, params);

аюсь добавить строку таблицы динамически в моей деятельности. Строка таблицы находится в относительной раскладке. Это выглядит хорошо, но не знаю, где я иду не так. Ниже мой код

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    RelativeLayout RLayout = (RelativeLayout)findViewById(R.id.RelativeLayout);
    TableRow tableRow = (TableRow)findViewById(R.id.TableRow);
    for(int i = 1; i <3; i++)
        RLayout.addView(tableRow); //My code is crashing here
}

И main.xml следующим образом

  <?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout
  android:id="@+id/RelativeLayout"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android"
  >
  <TableRow
  android:id="@+id/TableRow"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal"
  android:layout_alignParentTop="true"
  android:layout_alignParentLeft="true"
  >
  <TextView
  android:id="@+id/Text"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="Text"
  >
  </TextView>
  </TableRow>
  </RelativeLayout>

Пожалуйста помоги.

Ответы на вопрос(1)

Ваш ответ на вопрос