When I try to add more than one item (like Button and TextView together) in a RemoteView (for widget or custom notification) they superimpose each other.
Expection
Normally, I would want the items added inside RemoteViews to not overlap each other, like what happens in a Activity
What I tried
Adding a FrameLayout as a common parent of other items doesn't solve the problem, I tried to nested FrameLayouts inside FrameLayouts but that also didn't solve it.
Adding lots of padding makes the items underneath visible, but for buttons that is still a problem, they occupy all the padding space too and it isn't possible to click through the padded space to click the buttons underneath the padded button
Adding a LinearLayout hangs the script at the line where it is added
Sample code
import termuxgui as tg
def main():
with tg.Connection() as c:
# Create custom layout for notification
rv = tg.RemoteViews(c)
bt1 = rv.addButton()
rv.setText(bt1, "button1")
bt2 = rv.addButton()
rv.setText(bt2, "button2")
# Create a notification
notif = tg.Notification(c, "test", 3)
notif.setlayout(rv)
notif.notify()
input() # To prevent the notification from going away
exit()
return
if __name__ == "__main__":
main()
Problem
When I try to add more than one item (like Button and TextView together) in a RemoteView (for widget or custom notification) they superimpose each other.
Expection
Normally, I would want the items added inside RemoteViews to not overlap each other, like what happens in a Activity
What I tried
Sample code
The result: button2 overlaps button1
Version info