title: Why does it look different on different devices? Kivy
body: <p>I wrote an application on a PC and then compiled for android, but the result is different.</p>
  <p>I need the python code to look the way it really is.</p>
  <p><em><strong>Yes, I know that different devices have different pixel densities, will someone tell me how to solve my problem?</strong></em></p>
  <p><a href="https://i.stack.imgur.com/u5LS3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u5LS3.jpg" alt="enter image description here" /></a></p>
  <p>main.py:</p>
  <pre><code>from kivy.app import App
  from kivy.lang import Builder
  from kivy.uix.screenmanager import Screen
  
  class Test1(Screen):
      pass
  class Test2(Screen):
      pass
  
  kvfile = Builder.load_file('main.kv')
  class MainApp(App):
      def build(self):
          return kvfile
  
      def change_screen(self, screen_name):
          screen_manager = self.root.ids['screen_manager']
          screen_manager.current = screen_name
  
  MainApp().run()
  </code></pre>
  <p>main.kv:</p>
  <pre><code>&lt;Test1&gt;:
  FloatLayout:
      canvas:
          Color:
              rgba: hex('#D8D8D8')
          Rectangle:
              pos: 0, 565
              size: 1500, 2
          Rectangle:
              pos: 0, 48
              size: 1500, 2
      canvas.before:
          Color:
              rgba: hex('#ffffff')
          Rectangle:
              pos: self.pos
              size: self.size
      BoxLayout:
          pos_hint: {'top': 1, 'center_x': .5}
          size_hint_y: .055
          Label:
              text: 'ABC'
              bold: True
              background_color: hex('#ECEDF1')
              color: hex('#2D2E30')
      BoxLayout:
          pos_hint: {'top': .92, 'center_x': .5}
          size_hint_y: .82
          ScrollView:
              GridLayout:
                  cols: 1
                  size_hint_y: None
                  row_default_height: 50
                  height: self.minimum_height
                  Label:
                      text: '  A'
                      bold: True
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  B&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  C&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  D&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  E&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  F&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  G&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Label:
                      text: &quot;  H&quot;
                      bold: True
                      background_color: hex('#ECEDF1')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  I&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  J&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
                  Button:
                      text: &quot;  K&quot;
                      bold: True
                      background_normal: ''
                      background_down: ''
                      background_color: hex('#ffffff')
                      color: hex('#2D2E30')
                      text_size: self.size
                      halign: 'left'
                      valign: 'middle'
  
      BoxLayout:
          pos_hint: {'top': .08, 'center_x': .5}
          size_hint_y: .08
          Button:
              text: 'A'
              bold: True
              background_normal: ''
              background_down: ''
              background_color: hex('#ECEDF1')
              color: hex('#2D2E30')
              on_press:
                  app.change_screen('test1')
          Button:
              text: 'B'
              bold: True
              background_normal: ''
              background_down: ''
              background_color: hex('#ECEDF1')
              color: hex('#2D2E30')
              on_press:
                  app.change_screen('test2')
  </code></pre>