I'm New To Kivymd And working on a small project to learn it myself :)
I found in kivymd KitchenSink Demo to How to use toasts.
Here is The Demo code:
from kivymd.app import MDApp
from kivymd.toast import toast
from kivy.lang import Builder
KV = '''
BoxLayout:
orientation:'vertical'
MDToolbar:
id: toolbar
title: 'Test Toast'
md_bg_color: app.theme_cls.primary_color
left_action_items: [['menu', lambda x: '']]
FloatLayout:
MDRaisedButton:
text: 'TEST KIVY TOAST'
on_release: app.show_toast()
pos_hint: {'center_x': .5, 'center_y': .5}
'''
class Test(MDApp):
def show_toast(self):
'''Displays a toast on the screen.'''
toast('Test Kivy Toast')
def build(self):
return Builder.load_string(KV)
Test().run()
But The Problem is When I Compiled the exact same code using buildozer to apk it is toasting at the center of the screen when the button is clicked!
Am i doing anything wrong here? The buildozer successfully compiles the apk and the apk opens in my android without any crash, but the toast is not appearing in the bottom of the screen!, Instead it is appearing in the center of the screen.
What am I doing wrong in here?