1class ScrollExample_3(): 2 def __init__(self): 3 self.btn_cnt = 1 4 # 5 # Create a list with a floating button 6 # 7 8 list = lv.list(lv.scr_act()) 9 list.set_size(280, 220) 10 list.center() 11 12 for btn_cnt in range(2): 13 list.add_btn(lv.SYMBOL.AUDIO,"Track {:d}".format(btn_cnt)) 14 15 float_btn = lv.btn(list) 16 float_btn.set_size(50, 50) 17 float_btn.add_flag(lv.obj.FLAG.FLOATING) 18 float_btn.align(lv.ALIGN.BOTTOM_RIGHT, 0, -list.get_style_pad_right(lv.PART.MAIN)) 19 float_btn.add_event_cb(lambda evt: self.float_btn_event_cb(evt,list), lv.EVENT.ALL, None) 20 float_btn.set_style_radius(lv.RADIUS.CIRCLE, 0) 21 float_btn.set_style_bg_img_src(lv.SYMBOL.PLUS, 0) 22 float_btn.set_style_text_font(lv.theme_get_font_large(float_btn), 0) 23 24 def float_btn_event_cb(self,e,list): 25 code = e.get_code() 26 float_btn = e.get_target() 27 28 if code == lv.EVENT.CLICKED: 29 list_btn = list.add_btn(lv.SYMBOL.AUDIO, "Track {:d}".format(self.btn_cnt)) 30 self.btn_cnt += 1 31 32 float_btn.move_foreground() 33 34 list_btn.scroll_to_view(lv.ANIM.ON) 35 36scroll_example_3 = ScrollExample_3() 37 38 39