Delphi XE10让android的界面设计摆脱繁杂
来源:互联网 发布:上海网络教育本科 编辑:程序博客网 时间:2024/05/16 06:19
设计一个选项卡。
最终效果图样:
操作步骤:
1、创建一个multi_Device_Application;
2、在form上放一个Rectangle1,设置align为top。设置fill属性的kind为Gradient,编辑Gradient(颜色取值见样图)。
3、再放一个Rectange2设置align为top,底色为白色。
4、在Rectange2上放置三个RoundRect1,RoundRect2,RoundRect3。设置它们的Corners属性的TopLeft和TopRight为TURE,BottomLeft和BottomRight为FALSE,则圆角出现了。然后分别设置它们的Fill属性。
5、放置一个Tabcontrol控件,设置TopPostion为None;align为client。6、设置RoundRect1,RoundRect2,RoundRect3的tag属性分别为:1,2,3
直接上代码:
unit TabbedTemplate;interfaceuses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.TabControl, FMX.StdCtrls, FMX.Gestures, FMX.Controls.Presentation, FMX.Objects, FMX.Ani;type TTabbedForm = class(TForm) HeaderToolBar: TToolBar; ToolBarLabel: TLabel; TabControl1: TTabControl; TabItem1: TTabItem; TabItem2: TTabItem; TabItem3: TTabItem; GestureManager1: TGestureManager; Label2: TLabel; Label3: TLabel; Rectangle1: TRectangle; TabPanel: TPanel; Line1: TLine; RoundRect1: TRoundRect; RoundRect2: TRoundRect; Label5: TLabel; Label6: TLabel; RoundRect3: TRoundRect; Label7: TLabel; Rectangle2: TRectangle; Label1: TLabel; procedure FormCreate(Sender: TObject); procedure FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean); procedure TabControl1Gesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean); procedure TabHeadrOnClick(Sender: TObject); private { Private declarations } CurTabIndex:integer; public { Public declarations } end;var TabbedForm: TTabbedForm;implementation{$R *.fmx}procedure TTabbedForm.TabHeadrOnClick(Sender: TObject);var ClickTag:integer; i:integer;begin if (Sender is TLabel) then begin ClickTag:=Tlabel(sender).Tag end else if (Sender is TRoundRect) then begin ClickTag:=TRoundRect(Sender).Tag; end; if ClickTag<>CurTabIndex then begin for I := 0 to self.ComponentCount-1 do begin if (self.Components[i] is TRoundRect) then begin TRoundRect(self.Components[i]).Fill.Kind:=TBrushKind.Gradient; TRoundRect(self.Components[i]).Fill.Gradient.Color:= TAlphaColor($FFE2E4E4); TRoundRect(self.Components[i]).Fill.Gradient.Color1:=TAlphaColor($FFFFFFFF); TRoundRect(self.Components[i]).Fill.Gradient.Style:=TGradientStyle.Linear; TRoundRect(self.Components[i]).Stroke.Kind:=TBrushKind.None; end; end; TabControl1.ActiveTab:=TabControl1.Tabs[ClickTag-1];; CurTabIndex:=ClickTag; TRoundRect(sender).Fill.Kind:=TBrushKind.Solid; TRoundRect(Sender).Fill.Color:= TAlphaColorRec.Lightskyblue; TRoundRect(Sender).Stroke.Kind:=TBrushKind.Solid; TRoundRect(sender).stroke.Color:=TAlphaColorRec.Lightblue; end;end;procedure TTabbedForm.FormCreate(Sender: TObject);begin { This defines the default active tab at runtime } TabControl1.ActiveTab := TabItem1; CurTabIndex:=1;end;procedure TTabbedForm.FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean);begin{$IFDEF ANDROID} case EventInfo.GestureID of sgiLeft: begin if TabControl1.ActiveTab <> TabControl1.Tabs[TabControl1.TabCount-1] then begin TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex+1]; Handled := True; end; end; sgiRight: begin if TabControl1.ActiveTab <> TabControl1.Tabs[0] then begin TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex-1]; Handled := True; end; end; end;{$ENDIF}end;procedure TTabbedForm.TabControl1Gesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean);begin case EventInfo.GestureID of sgiRight: begin TabControl1.Previous(); Handled:=True; end; sgiLeft: begin TabControl1.Next(); Handled:=True; end; end;end;end.
本文转载于:http://www.cnblogs.com/wangorg/p/5130858.html
0 0
- Delphi XE10让android的界面设计摆脱繁杂
- 关于使用Delphi XE10 进行android开发的一些总结
- Delphi XE10支持IOS IPV6的处理
- Delphi xe10对json的解析应用
- delphi xe10.2自带的sha1sha2
- Delphi XE10 给地图层上面添加Android原生控件
- Delphi XE10 序列化 TDictionary 为 JSON 的问题
- Delphi XE, XE10, 创建 ActiveForm 和 ActiveX 工程的方法
- Delphi XE10编写的《开放式公路收费系统》
- [已解决]Delphi XE10 Android 程序引用百度定位Jar包后, 某些手机上闪退的问题
- 安装好DELPHI XE10,参照手册简单的创建了一个android app 程序,run的时提示: Android SDK tools are required. Do you want to d
- 迅速让你摆脱无聊的网站~~~
- android 自定义View SpinnerLoader使用解析,让你摆脱系统难看的进度条
- android Log工具框架,LogUtils让你摆脱TAG的魔爪
- 开源整理:酷酷的Android Loading动画,让用户摆脱无聊等待
- 开源整理:酷酷的Android Loading动画,让用户摆脱无聊等待
- Delphi XE10 加载ArcGIS for Android Jar包, 并成功显示在线地图
- 项目管理的繁杂
- ACM日记_17.3.14——高精度算法
- JS JAVA 判断是否微信浏览器
- VirtualBox虚拟硬盘文件管理
- 【tensorTensorFlow学习笔记】Mac+Linux虚拟机安装TensorFlow
- 与用户互动
- Delphi XE10让android的界面设计摆脱繁杂
- Android性能优化之内存优化实战
- 字符串中Emoji表情处理
- 防止ajax多次提交
- Javascript use strict
- 代码行技术
- linux 创建连接命令 ln -s 软链接
- Android版本更新知识(检测、升级)总结
- Gradle Wrapper