Преглед на файлове

FragmentScreen under topBar if set in navigatorStyle

Yedidya Kennard преди 8 години
родител
ревизия
e40f2b6e56
променени са 1 файла, в които са добавени 11 реда и са изтрити 6 реда
  1. 11
    6
      android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java

+ 11
- 6
android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java Целия файл

@@ -32,19 +32,24 @@ public class FragmentScreen extends Screen {
32 32
 
33 33
     @Override
34 34
     protected void createContent() {
35
-        FrameLayout frame = new FrameLayout(getContext());
36
-        LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
37
-        params.addRule(BELOW, topBar.getId());
38
-        addView(frame, params);
39 35
         content = new FrameLayout(getContext());
40 36
         content.setId(ViewUtils.generateViewId());
41 37
         ContentView contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, null);
42
-        addView(contentView);
43
-        frame.addView(content, MATCH_PARENT, MATCH_PARENT);
38
+        addView(content, addBelowTopBar());
44 39
         addFragment();
45 40
         contentView.init();
46 41
     }
47 42
 
43
+    @NonNull
44
+    private LayoutParams addBelowTopBar() {
45
+        LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
46
+        if (!screenParams.styleParams.drawUnderTopBar) {
47
+            params.addRule(BELOW, topBar.getId());
48
+        }
49
+        return params;
50
+    }
51
+
52
+
48 53
     private void addFragment() {
49 54
         try {
50 55
             Fragment fragment = tryGetFragment();