Smobiler上海石磨_.NET移动开发平台

标题: smobiler仿饿了么app搜索页面 [打印本页]

作者: Lula.Jin    时间: 2021-3-11 11:51
标题: smobiler仿饿了么app搜索页面
饿了么-搜索页面如下图所示:
[attach]2157[/attach]


完整代码见git :https://github.com/comsmobiler/BlogsCode



创建窗体

创建一个smobilerForm ,文件名设置ElmSearching, 将窗体的Layout设置Relative,再设置窗体的Statusbar属性



[attach]2158[/attach]

并在窗体中拖入Panel和ListView,Panel.Height 设置40,Listview.Flex设置1 ,Listview的模板类设置成ListLayout

[attach]2159[/attach]





实现搜索框

将上图的panel1.Layout设置Relative,panel1.Direction设置Row,panel1.Padding设置(6,6,6,6),panel1.Size设置为(0,40)。

在panel1中拖入imageButton1,

imageButton1.ImagtType设置FontIcon,

imageButton1.ResourceID设置” angle-left” ,

imageButton1.Size设置(27,0)。

在imageButton1的点击事件中写this.Close();

接着在panel1中拖入panel2,

panel2.BorderRadius设置12,

panel2.Direction设置Row,

panel2.ItemAlign设置Center,

panel2.Layout设置Relative,

panel2.Touchable设置true,

panel2.BackColor设置WhiteSmoke,

panel2.Magrin设置(6,0,0,0),

panel2.Flex设置1 。

在panel2 中加入fonticon控件,

fontIcon1.Location设置(6,0),

fontIcon1.Size设置(15,15),

fontIcon1.ForeColor设置Gainsboro,

fontIcon1.Resource设置”search”

在panel2中继续加入Label控件,Label控件的Name设置KeyLab,

KeyLab.Flex设置1

KeyLab.ForeColor设置Gainsboro

KeyLab.Location设置(6,0,0,0)

KeyLab.Margin设置(6,0,0,0)

KeyLab.Padding设置(4,0,0,0)

KeyLab.Text设置”曼玲粥店”

创建SmobilerUserControl

创建一个SmobilerUserControl,文件名设置ElmLayout, 将ElmLayout.Layout设置Relative,BackColor s设置White,Flex设置1


[attach]2160[/attach]


上图panel1 用来实现搜索框,步骤和前面一样,只是ELmLayout中的KeyLab改成TextBox控件,最后在ElmLayout中拖入两个panel,分别命名为hisPanel和disPanel,这两个Panel的Size设置(0,0)。这样设计器部分就完成了。具体代码见git :https://github.com/comsmobiler/BlogsCode







欢迎光临 Smobiler上海石磨_.NET移动开发平台 (https://www.smobiler.com/) Powered by Discuz! X3.2