Browse Source

Fix drawUnderTopBar in ViewPagerScreen

Guy Carmeli 8 years ago
parent
commit
6630e22a3a

+ 6
- 4
android/app/src/main/java/com/reactnativenavigation/screens/ViewPagerScreen.java View File

6
 import android.support.v7.app.AppCompatActivity;
6
 import android.support.v7.app.AppCompatActivity;
7
 import android.view.View;
7
 import android.view.View;
8
 import android.view.ViewGroup;
8
 import android.view.ViewGroup;
9
+import android.widget.RelativeLayout;
9
 
10
 
10
 import com.reactnativenavigation.params.ScreenParams;
11
 import com.reactnativenavigation.params.ScreenParams;
11
 import com.reactnativenavigation.params.TopTabParams;
12
 import com.reactnativenavigation.params.TopTabParams;
32
         contentViews = new ArrayList<>();
33
         contentViews = new ArrayList<>();
33
         viewPager = new ViewPager(getContext());
34
         viewPager = new ViewPager(getContext());
34
         viewPager.setOffscreenPageLimit(99);
35
         viewPager.setOffscreenPageLimit(99);
35
-        addView(viewPager);
36
+        RelativeLayout.LayoutParams lp = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
37
+        if (screenParams.styleParams.drawScreenBelowTopBar) {
38
+            lp.addRule(BELOW, topBar.getId());
39
+        }
40
+        addView(viewPager, lp);
36
 
41
 
37
         for (TopTabParams topTabParam : screenParams.topTabParams) {
42
         for (TopTabParams topTabParam : screenParams.topTabParams) {
38
             ContentView contentView = new ContentView(getContext(),
43
             ContentView contentView = new ContentView(getContext(),
51
 
56
 
52
     private void addContent(ContentView contentView) {
57
     private void addContent(ContentView contentView) {
53
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
58
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
54
-        if (screenParams.styleParams.drawScreenBelowTopBar) {
55
-            params.addRule(BELOW, topBar.getId());
56
-        }
57
         viewPager.addView(contentView, params);
59
         viewPager.addView(contentView, params);
58
     }
60
     }
59
 
61