我用按钮创建了一个片段,但单击按钮时没有调用onclicklistener。
这是我的片段类代码
public class UserEntryFragment extends Fragment implements OnClickListener {
EditText member_num,password;
Button submit;
ProgressBar progressBar;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.main,container, false);
member_num = (EditText) view.findViewById(R.id.member_num);
password = (EditText) view.findViewById(R.id.password);
submit = (Button) view.findViewById(R.id.submit);
progressBar = (ProgressBar) view.findViewById(R.id.progressBar1);
submit.setOnClickListener(this);
return view;
}
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
if (view == submit) {
System.out.println("Button Clicked");
}
}
我错过了什么或者做错了吗?
提前谢谢。