瀏覽代碼

Added ContentView to FragementScreen

Yedidya Kennard 8 年之前
父節點
當前提交
4c371d2a17
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7
    2
      android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java

+ 7
- 2
android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java 查看文件

4
 import android.app.FragmentManager;
4
 import android.app.FragmentManager;
5
 import android.app.FragmentTransaction;
5
 import android.app.FragmentTransaction;
6
 import android.os.Bundle;
6
 import android.os.Bundle;
7
+import android.support.annotation.NonNull;
7
 import android.support.annotation.Nullable;
8
 import android.support.annotation.Nullable;
8
 import android.support.v7.app.AppCompatActivity;
9
 import android.support.v7.app.AppCompatActivity;
9
 import android.widget.FrameLayout;
10
 import android.widget.FrameLayout;
31
 
32
 
32
     @Override
33
     @Override
33
     protected void createContent() {
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
         content = new FrameLayout(getContext());
39
         content = new FrameLayout(getContext());
35
         content.setId(ViewUtils.generateViewId());
40
         content.setId(ViewUtils.generateViewId());
36
         ContentView contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, null);
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
         addFragment();
44
         addFragment();
40
         contentView.init();
45
         contentView.init();
41
     }
46
     }