Android 手机上的应用程序显示问题:屏幕可见性有限

问题描述 投票:0回答:0

问题: 应用程序仅显示在我屏幕的 10% 中,它显示在我的 Android 手机的一角。所有的屏幕都是这样产生的。该应用程序在 Windows 上完美运行。在 Windows 10 上运行时,该应用程序会显示在整个窗口中。我在 Google collab 上使用 buildozer 导出。

试过: 我尝试更改 kivy 版本,切换到其他屏幕,使用另一部手机,使用 kivymd 而不是 kivy 和 visversa[android 设备上的屏幕second screen on android device](https://i.stack.imgur.com/8hvFQ.jpg)

我尝试更改 kivy 版本,切换到其他屏幕,使用另一部手机,使用 kivymd 而不是 kivy 和 visversa,导出一个显示全屏的更简单的应用程序

这是我的代码摘要

`from kivymd.uix.button import MDFloatingActionButton
from kivy.properties import NumericProperty
import kivy
from kivy.uix.textinput import TextInput
import os
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivymd.uix.button import MDRectangleFlatButton
import sqlite3
from kivy.properties import ListProperty, ObjectProperty
from kivy.metrics import dp
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.scrollview import ScrollView
from kivymd.uix.button import MDRaisedButton
from kivymd.uix.textfield import MDTextField
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.app import MDApp
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.window import Window
from kivymd.uix.label import MDLabel
from kivy.clock import Clock
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label

class LoginScreen(Screen):
    def __init__(self, screen_manager, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        self.screen_manager = screen_manager


        layout = MDBoxLayout(orientation='vertical', spacing=10, padding=50)

        self.username = TextInput(hint_text="Username", size_hint=(1, None), height='40dp')
        layout.add_widget(self.username)

        self.password = TextInput(
            hint_text="Password", password=True, size_hint=(1, None), height='40dp')
        layout.add_widget(self.password)

        login_button = Button(text="Login", size_hint=(1, None), height='40dp')
        login_button.bind(on_release=self.login)
        layout.add_widget(login_button)

        self.message_label = MDLabel(halign='center', valign='top', size_hint=(1, None), height='40dp')
        layout.add_widget(self.message_label)
        self.add_widget(layout)

    def login(self, instance):
        print("pressed")
        username = self.username.text
        password = self.password.text

        users = {
            "Torkyo": "*****",
            "Menzi": "*****",
            "": "", #Driver1 Allahakba
            "Sakhile": "****",
            "Andre": "****"
        }

        if username in users and users[username] == password:
            if username == "Torkyo":
                self.parent.parent.current = 'torkyo_screen'
            elif username == "Menzi":
                self.parent.parent.current = 'menzi_screen'
            elif username == "":
                self.screen_manager.current = 'dirisa_screen'
            elif username == "Sakhile":
                self.parent.parent.current = 'manager_screen'
            elif username == "Andre":
                self.parent.parent.current = 'andre_screen'

class LoginApp(MDApp):
    def build(self):
        sm = ScreenManager()
        login_screen = LoginScreen(sm, name='login_screen')
        sm.add_widget(login_screen)
        sm.add_widget(TorkyoScreen(sm, name='torkyo_screen'))
        sm.add_widget(Driver1Screen(sm, name='dirisa_screen'))
        sm.add_widget(AndreScreen(sm, name='andre_screen'))
        sm.add_widget(MenziScreen(sm, name='menzi_screen'))
        sm.add_widget(CustomerManagementScreen(sm,
                                               name='Customer_Management_screen'))
        sm.add_widget(TorkyoCustomerDetailsScreen(
            sm, name='torkyo_customer_details_screen'))
        sm.add_widget(AndreCustomerDetailsScreen(sm,
                                                 name="customer_details_andre"))
        return sm

    def login(self):
        self.root.ids.login_screen.login(None)


class PopupWindow(Popup):
    pass


if __name__ == "__main__":
    Window.size = (300, 200)
    LoginApp().run()

#also added this 
from kivy.config import Config
Config.set('graphics', 'width', 'auto')
Config.set('graphics', 'height', 'auto')
Config.set('graphics', 'fullscreen', 'auto')
`
#my code is 1045 lines long

#on my buidozer spec file I tried
fullscreen = True

all didn't work
python kivy buildozer
© www.soinside.com 2019 - 2024. All rights reserved.