You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.6 KiB

package com.example.dxsdpdb;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
public class IndexFragment extends Fragment {
private View view = null;
private Button submit_buttion,accept_button;
private ImageButton market_button,losing_button,college_button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
if (view==null){
view= inflater.inflate(R.layout.fragment_index,container,false);
submit_buttion = view.findViewById(R.id.raise_button);
accept_button = view.findViewById(R.id.accept_button);
market_button = view.findViewById(R.id.market_button);
losing_button = view.findViewById(R.id.losing_button);
college_button = view.findViewById(R.id.college_buttion);
initEvents();
}
return view;
}
private void initEvents() {
View.OnClickListener onClickListener = new View.OnClickListener() {
public void onClick(View v) {
switch (v.getId()) {
case R.id.raise_button:
;
break;
case R.id.accept_button:
;
break;
case R.id.market_button:
Toast.makeText(getActivity(),"此功能暂未开放!",Toast.LENGTH_SHORT).show();
break;
case R.id.losing_button:
Toast.makeText(getActivity(),"此功能暂未开放!",Toast.LENGTH_SHORT).show();
break;
case R.id.college_buttion:
Toast.makeText(getActivity(),"此功能暂未开放!",Toast.LENGTH_SHORT).show();
break;
}
}};
//设置三个 Tab 的点击事件
submit_buttion.setOnClickListener(onClickListener);
accept_button.setOnClickListener(onClickListener);
market_button.setOnClickListener(onClickListener);
losing_button.setOnClickListener(onClickListener);
college_button.setOnClickListener(onClickListener);
}
}