我正在使用 tabbedActivity 制作一个用于研究的应用程序,加上按钮没有采取行动,有人知道解释原因,我尝试了几种形式,但都没有采取行动,不给出错误并破坏应用程序,但按钮什么也没有
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
rooView = inflater.inflate(R.layout.fragment_teste, container, false);
final Context context = getContext();
button = (Button) rooView.findViewById(R.id.button);
button.setOnClickListener((View.OnClickListener) this);
return rooView;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button:
Toast.makeText(getContext(), "Teste", Toast.LENGTH_LONG).show();
break;
}
}