TableView에서 ImageView를 추가하고 싶습니다. 나는 모든 일을하지만 아무것도 보이지 않는다. 어떻게 해결할 수 있습니까? 당신이 TableRow를 추가하는 데 사용되기 때문에ImageView in TableLayout
이public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.buddy_list);
TableLayout buddy_list_layout = (TableLayout)findViewById(R.id.buddy_list_layout);
TableRow tableRow = new TableRow(this);
TableLayout.LayoutParams layoutParams1 = new TableLayout.LayoutParams(
TableLayout.LayoutParams.FILL_PARENT,
50);
ImageView imageView = new ImageView(this);
imageView.setImageResource(R.drawable.troll_logo);
TableLayout.LayoutParams layoutParams2 = new TableLayout.LayoutParams(50, 50);
tableRow.addView(imageView, layoutParams2);
buddy_list_layout.addView(tableRow, layoutParams1);
} // end -> method -> onCreate
동적이어야합니까? xml을 통해 이것을하는 것이 더 쉽다면 ... – matt5784
예. 나는 역동적이되고 싶다. –