gesture控件

一、使用场景

为丰富页面之间的切换方式,且实现统一的管理,lv_gesture控件对右滑退出功能进行了封装,保证页面切换的触发方式统一性。

二、功能介绍

1、主要接口说明

右滑退出动画根据跟手动画的区域大小不同主要分为三种形式,如图所示,区域大小根据line的位置而确定。

  • 全屏任意位置右滑退出,line的位置位于屏幕的右侧。

  • 限定区域的右滑退出,line的位置靠经屏幕左边,但保留一定距离。

  • 全屏右滑退出且不带跟手动画。line位于屏幕左边

fishy

主要配置line的位置,以及是否使能非跟手动画。为简化代码回调,GUI已实现了该回调函数,外部只需指定line位置和是否使能非跟手动画

//Set gesture paramers
//left_area the gesture wiil trigger an animation when the start point in the line left.o for no animation,Lv_HoR_REs_MAx for //animationif
//goback_en the gesture wiil do not trigger an animation when the start point in the line right.Closely related to left_area parameter
//event_cbUser-definedcaliback
lv_gesture_init(lvcoordtleft_area,uint8_tgoback_en,lv_gesture_event_cb_tevent_cb);

void gui_app_gesture_set_parem(lv_coord_t left_area,uint8_tgoback_en);

使能或禁止手势动画

//Enable gesture function, the status switch will be performed after idle is entered.
void lv_gesture_enable(void);
//Disable gesturefunction,thestatus switch wiil be performed after idleisentered.
void lv_gesture_disable(void);

2、案例说明

比如在平铺页面有右滑翻页手势,则必须禁止右滑退出手势。

static void on_resume(void)
{
	//...
	lv_gesture_disable();
}
static void on_pause(void)
{
	//...
	lv_gesture_enable();
}

再如没有页面只需左边区域具有右滑手势动画,则可通过调用该接口实现切换。

static void on_resume(void)
{
	//...
	gui_app_gesture_set_parem(50,false);
}

四、注意事项