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

changed centering logic of title on android (#1164)

Kelt преди 8 години
родител
ревизия
1d73739dc5
променени са 1 файла, в които са добавени 2 реда и са изтрити 4 реда
  1. 2
    4
      android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java

+ 2
- 4
android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java Целия файл

91
             @Override
91
             @Override
92
             public void run() {
92
             public void run() {
93
                 if (params.titleBarTitleTextCentered) {
93
                 if (params.titleBarTitleTextCentered) {
94
-                    int[] location = new int[2];
95
-                    titleView.getLocationOnScreen(location);
96
-                    titleView.setTranslationX(titleView.getTranslationX() + (-location[0] + ViewUtils.getScreenWidth() / 2 - titleView.getWidth() / 2));
94
+                    titleView.setX(ViewUtils.getScreenWidth() / 2 - titleView.getWidth() / 2);
97
                 }
95
                 }
98
-
96
+                
99
             }
97
             }
100
         });
98
         });
101
     }
99
     }