package com.example.home;
import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class LoginFragment extends Fragment {
Button bt1;
private MeFragment meFragment=new MeFragment();
private LoginFragment loginFragment;
@SuppressLint("ResourceType")
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View loginlayout = inflater.inflate(R.layout.fragment_login, container, false);
bt1 = loginlayout.findViewById(R.id.login);
bt1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentManager fm = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
transaction.replace(R.id.tab_login1, meFragment).commit();
}
});
return loginlayout;
}
}
点击登陆后 个人中心和登陆界面并存了