sprintf(str, "%d", data.step);
LayerText lt_step = {str, frame_step, GAlignCenter, GColorWhite, U_ASCII_ARIAL_20};
p_layer = app_layer_create_text(<_step);
app_layer_set_bg_color(p_layer, color1);
app_window_add_layer(p_window, p_layer);
/*创建并显示文本图层*/
int32_t display_target_layerText(P_Window p_window, const GRect *temp_p_frame, enum GAlign how_to_align, enum GColor color, char * str, uint8_t font_type, enum GColor fcolor)
{
LayerText temp_LayerText = {0};
temp_LayerText.text = str;
temp_LayerText.frame = *temp_p_frame;
temp_LayerText.alignment = how_to_align;
temp_LayerText.font_type = font_type;
temp_LayerText.foregroundColor = fcolor;
P_Layer p_layer = app_layer_create_text(&temp_LayerText);
if (p_layer != NULL)
{
app_layer_set_bg_color(p_layer, color);
return app_window_add_layer(p_window, p_layer);
}
return 0;
}
qs100371 发表于 2018-8-5 16:39
这两处都是文字颜色的设置,不用单独的API。第二个是官方用来显示文字图层的专用函数。
...
qs100371 发表于 2018-8-5 17:02
图层不支持动态改变颜色,只可更改文字,只能通过建立新层来替换旧层。
app_window_replace_layer ...
欢迎光临 麦步社区-论坛 (http://203.195.186.190/) | Powered by Discuz! X3.2 |