我已经有了一个ViewFlipper,它被多个视图填充,实际上它们是同一个视图。一切工作正常,但设置的onClickListener的按钮工作不喜欢预期:ViewFlipper与不同点击监听器的相同视图
flipStack = (ViewFlipper) findViewById(R.id.clubViewFlipper);
for(int i=0; i<= clubDataSet.size()-1; i++) {
clubData = clubDataSet.get(i);
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = vi.inflate(R.layout.detail_overlay, (ViewGroup)findViewById(R.id.clubDetailScrollView), false);
Button websiteButton = (Button) view.findViewById(R.id.clubDetailWebsiteButton);
websiteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(webIntent);
}
});
flipStack.addView(view);
}
的ViewFlipper的意见,每一个websiteButton被设置为相同的URL现在。有没有办法改变,或者我的方法与ViewFlipper错误?
谢谢!
brejoc
非常感谢!这是解决方案! – brejoc 2011-06-05 21:07:39