Bläddra i källkod

Added ContentView to FragementScreen

Yedidya Kennard 8 år sedan
förälder
incheckning
4c371d2a17

+ 7
- 2
android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java Visa fil

@@ -4,6 +4,7 @@ import android.app.Fragment;
4 4
 import android.app.FragmentManager;
5 5
 import android.app.FragmentTransaction;
6 6
 import android.os.Bundle;
7
+import android.support.annotation.NonNull;
7 8
 import android.support.annotation.Nullable;
8 9
 import android.support.v7.app.AppCompatActivity;
9 10
 import android.widget.FrameLayout;
@@ -31,11 +32,15 @@ public class FragmentScreen extends Screen {
31 32
 
32 33
     @Override
33 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);
34 39
         content = new FrameLayout(getContext());
35 40
         content.setId(ViewUtils.generateViewId());
36 41
         ContentView contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, null);
37
-        addView(contentView, 0, 0);
38
-        addView(content, MATCH_PARENT, MATCH_PARENT);
42
+        addView(contentView);
43
+        frame.addView(content, MATCH_PARENT, MATCH_PARENT);
39 44
         addFragment();
40 45
         contentView.init();
41 46
     }