Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 691 Bytes

fragment.md

File metadata and controls

36 lines (27 loc) · 691 Bytes

Fragment

创建一个Fragment路由

@Route("/fragment/test")
public class TestFragment extends Fragment {
    @Extra("userId")
    int userId;

    @Extra("userName")
    String userName;
    
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //参数注入
        Rudolph.bind(this);
    }
}

调用方式:

  • 1.引用方式调用
Fragment fragment = TestFragmentRouter.builder().userId(11).userName("John").execute();
  • 2.URL方式调用
Rudolph.builder("/fragment/user?userId=11&userName=John").execute();