我有一个TableLayout并且我以编程方式填充它,但我希望当我点击整行时更改一个值时,这是我的代码:
for (int i = 0 ; i < adress ; i++) {
String adress = notepad.get(i).getadress();
String Phone = notepad.get(i).getphone();
View noteView = LayoutInflater.from(getActivityContext()).inflate(R.layout.notepad_table, note_pad_table_Layout, false);
TextView adressTextView = (TextView) quoteView.findViewById(R.id.note_pad_adress);
TextView phoneTextView = (TextView) quoteView.findViewById(R.id.note_pad_phone);
adressTextView.setText(adress);
phoneTextView.setText(Phone);
adressTextView.setOnClickListener(new HideClickListener());
note_pad_table_Layout.addView(noteView);
}
这是我的布局:
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/note_pad_adress"
android:layout_height="wrap_content"
android:padding="10dp"/>
<TextView
android:id="@+id/note_pad_phone"
android:layout_height="wrap_content"
android:padding="10dp"/>
<TableRow/>