소스 검색

Fix drawUnderTopBar in ViewPagerScreen

Guy Carmeli 8 년 전
부모
커밋
6630e22a3a
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6
    4
      android/app/src/main/java/com/reactnativenavigation/screens/ViewPagerScreen.java

+ 6
- 4
android/app/src/main/java/com/reactnativenavigation/screens/ViewPagerScreen.java 파일 보기

@@ -6,6 +6,7 @@ import android.support.v4.view.ViewPager;
6 6
 import android.support.v7.app.AppCompatActivity;
7 7
 import android.view.View;
8 8
 import android.view.ViewGroup;
9
+import android.widget.RelativeLayout;
9 10
 
10 11
 import com.reactnativenavigation.params.ScreenParams;
11 12
 import com.reactnativenavigation.params.TopTabParams;
@@ -32,7 +33,11 @@ public class ViewPagerScreen extends Screen {
32 33
         contentViews = new ArrayList<>();
33 34
         viewPager = new ViewPager(getContext());
34 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 42
         for (TopTabParams topTabParam : screenParams.topTabParams) {
38 43
             ContentView contentView = new ContentView(getContext(),
@@ -51,9 +56,6 @@ public class ViewPagerScreen extends Screen {
51 56
 
52 57
     private void addContent(ContentView contentView) {
53 58
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
54
-        if (screenParams.styleParams.drawScreenBelowTopBar) {
55
-            params.addRule(BELOW, topBar.getId());
56
-        }
57 59
         viewPager.addView(contentView, params);
58 60
     }
59 61