📅  最后修改于: 2022-03-11 15:00:17.235000             🧑  作者: Mango
public class fragmentOne extends Fragment implements OnClickListener {
Button myButton;
@Override
public View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedinstanceState) {
View myView = inflater.inflate(R.layout.fragment_1, container, false);
myButton = (Button) myView.findViewById(R.id.myButton);
myButton.setOnClickListener(this);
return myView;
}
@Override
public void onClick(View v) {
// implements your things
}
}