@@ -60,12 +60,36 @@ public class BufferKnifeActivity extends AppCompatActivity {
6060 }
6161```
6262
63- ### #2 How to add Toolbar or TitleView in custom Callback?
64- Because there are so many styles of TitleView, LoadSir didn't support this feature. You can register the View below the
65- TitleView instead. So that LayoutLoad will not include the TitleView.
63+ ### #2 How to keep the toolbar in Fragment?
64+ ``` java
65+ @Nullable
66+ @Override
67+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
68+ savedInstanceState) {
69+ ViewGroup rootView = (ViewGroup ) inflater. inflate(R . layout. title_title_bar, container, false );
70+ unBinder = ButterKnife . bind(this , rootView);
71+ RelativeLayout titleBarView = (RelativeLayout ) rootView. findViewById(R . id. rl_titleBar);
72+ LinearLayout contentView = (LinearLayout ) rootView. findViewById(R . id. ll_content);
73+ rootView. removeView(contentView);
74+ LoadSir loadSir = new LoadSir .Builder ()
75+ .addCallback(new EmptyCallback ())
76+ .addCallback(new LoadingCallback ())
77+ .setDefaultCallback(LoadingCallback . class)
78+ .build();
79+ loadService = loadSir. register(contentView, new Callback .OnReloadListener () {
80+ @Override
81+ public void onReload (View v ) {
82+ loadService. showSuccess();
83+ }
84+
85+ });
86+ return loadService. getTitleLoadLayout(getContext(), rootView, titleBarView);
87+ }
88+ ```
6689
6790If you have a better idea, please let me know. I'm very interested to improve LoadSir in any way. Thanks for your help.
6891
92+
6993### #3 ` setDefaultCallback(...) ` vs ` addCallback(...) `
7094What's the purpose of a ` DefaultCallback ` ?
7195
0 commit comments