### 1. 字符串转换与路径处理
- **JStringToString、StringToJString、StrToJURI**:在XE6中不支持这些函数,需要使用`Androidapi.Helpers`单元。
### 2. Splash Image设置
- **问题**:Delphi XE5、XE6、XE7编译的程序在Android下启动时会有一段时间的黑屏。
- **解决方案**:Delphi XE7增加了Splash Image显示功能。
- **步骤**:
1. 右键点击工程,选择Options。
2. 进入Application分页。
3. 勾选Include Splash Image。
4. 选择Splash Image文件。
5. 设置Splash Tile Mode和Splash Gravity。
- **Splash Tile Mode**:
- `disabled`:按图片尺寸大小显示,位置由Splash Gravity设置。
- `clamp`:图形边框适应屏幕大小。
- `repeat`:屏幕水平、竖立方向重复填充满Splash Image。
- `mirror`:与repeat类似,图片是镜像的。
- **Gravity**:设置比屏幕小的图片在屏幕中的位置,仅当Splash Tile Mode为Disable时有效。
### 3. 带文件发布
- **步骤**:
1. 菜单 `project -> deployment`。
2. 点击增加按钮,选择sqlite数据文件(如test.s3db)。
3. 设置remote path为`assets\internal\`。
### 4. 应用显示中文名
- **步骤**:
1. 菜单 `project -> Option -> Version Info -> label`。
### 5. FMX.Consts汉化
- **步骤**:修改FMX.Consts单元中的字符串常量,例如将`SMsgDlgWarning`从`'Warning'`改为`'警告'`。
### 6. 临时文件路径(支持安卓、IOS)
- **代码示例**:
```delphi
function GetFileName(const AFileName: string): string;
begin
{$IFDEF ANDROID}
Result := TPath.GetTempPath + '/' + AFileName;
{$ELSE}
{$IFDEF IOS}
Result := TPath.GetHomePath + '/Documents/' + AFileName;
{$ELSE}
Result := AFileName;
{$ENDIF}
{$ENDIF}
end;
```
### 7. IOUtils文件说明
- **路径类**:
- `TPath.GetTempPath`:获取临时文件夹路径。
- `TPath.GetTempFileName`:获取一个临时文件名。
- `TPath.GetPathRoot`:提取盘符。
- `TPath.GetDirectoryName`:提取路径。
- `TPath.GetFileName`:提取文件名。
- `TPath.GetExtension`:提取扩展名。
- `TPath.GetFileNameWithoutExtension`:提取无扩展名的文件名。
- `TPath.ChangeExtension`:更换扩展名。
- `TPath.DriveExists`:检查路径中的驱动器是否存在。
- `TPath.GetFullPath`:根据相对路径给出全路径。
- `TPath.HasExtension`:判断是否有扩展名。
- `TPath.IsPathRooted`:判断是否是绝对路径。
- `TPath.Combine`:结合路径。
- `TPath.GetRandomFileName`:产生一个随机文件名。
- `TPath.GetGUIDFileName`:用于产生一个唯一的文件名。
- `TPath.IsValidPathChar`:判断给定的字符是否能用于路径名。
- `TPath.IsValidFileNameChar`:判断给定的字符是否能用于文件名。
- `TPath.AltDirectorySeparatorChar`:Windows下是`\`。
- `TPath.ExtensionSeparatorChar`:Windows下是`.`。
- `TPath.PathSeparator`:Windows下是`;`。
- `TPath.VolumeSeparatorChar`:Windows下是`:`。
- **目录类**:
- `TDirectory.CreateDirectory`:建立新目录。
- `TDirectory.Exists`:判断文件夹是否存在。
- `TDirectory.IsEmpty`:判断文件夹是否为空。
- `TDirectory.Copy`:复制文件夹。
- `TDirectory.Move`:移动文件夹。
- `TDirectory.Delete`:删除文件夹。
- `TDirectory.GetDirectoryRoot`:获取目录的根盘符。
- `TDirectory.GetCurrentDirectory`:获取当前目录。
- `TDirectory.SetCurrentDirectory`:设置当前目录。
- `TDirectory.GetLogicalDrives`:获取驱动器列表。
- `TDirectory.GetAttributes`:获取文件夹属性。
- `TDirectory.SetAttributes`:设置文件夹属性。
- **文件类**:
- `TFile.Exists`:判断