【发布时间】:2014-07-16 10:37:56
【问题描述】:
我需要打印TextView 的文本,单击Button 将其删除。
这是我目前的代码:
public void function() {
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View addView = layoutInflater.inflate(R.layout.row, null);
TextView textOut = (TextView) addView.findViewById(R.id.textout);
textOut.setText(test.get(i).toString());
Button buttonRemove = (Button) addView.findViewById(R.id.remove);
buttonRemove.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((LinearLayout) addView.getParent()).removeView(addView);
//need to print the value of the removed textview
}
});
container.addView(addView);
}
【问题讨论】:
-
究竟是什么问题?
标签: android dynamic-programming layout-inflater