zoukankan      html  css  js  c++  java
  • Android实例-处理隐藏输入法后不再显示问题(XE8+小米2)

    结果:

    1.可以处理再次显示问题,但缺点是每个控件都要处理一次,累。哪位大神有好的处理方法,请M我。

    实例代码:

     1 unit Unit1;
     2 
     3 interface
     4 
     5 uses
     6   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
     7   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ComboEdit,
     8   FMX.Edit, FMX.EditBox, FMX.NumberBox, FMX.DateTimeCtrls, FMX.ScrollBox,
     9   FMX.Memo, FMX.Controls.Presentation, FMX.StdCtrls,
    10   FMX.VirtualKeyboard,//需要引入
    11   FMX.Platform,//需要引入
    12   FMX.Layouts;
    13 
    14 type
    15   TForm1 = class(TForm)
    16     VertScrollBox1: TVertScrollBox;
    17     Layout1: TLayout;
    18     Memo1: TMemo;
    19     Label1: TLabel;
    20     Button1: TButton;
    21     Edit1: TEdit;
    22     Edit2: TEdit;
    23     procedure FormCreate(Sender: TObject);
    24     procedure FormFocusChanged(Sender: TObject);
    25     procedure FormVirtualKeyboardHidden(Sender: TObject;
    26       KeyboardVisible: Boolean; const Bounds: TRect);
    27     procedure FormVirtualKeyboardShown(Sender: TObject;
    28       KeyboardVisible: Boolean; const Bounds: TRect);
    29     procedure Edit2Click(Sender: TObject);
    30   private
    31     //定义输入法变量
    32     FService: IFMXVirtualKeyboardToolbarService;
    33     FService_kb: FMX.VirtualKeyboard.IFMXVirtualKeyboardService;
    34     { Private declarations }
    35   public
    36     { Public declarations }
    37   end;
    38 
    39 var
    40   Form1: TForm1;
    41 
    42 implementation
    43 
    44 {$R *.fmx}
    45 {$R *.NmXhdpiPh.fmx ANDROID}
    46 //如果再次点击EDIT应做出反映
    47 procedure TForm1.Edit2Click(Sender: TObject);
    48 begin
    49   if TEdit(Sender).IsFocused and Assigned(FService_kb) then
    50   try
    51     FService_kb.ShowVirtualKeyboard(TEdit(Sender));
    52   except
    53   end;
    54 end;
    55 
    56 procedure TForm1.FormCreate(Sender: TObject);
    57 begin
    58   //控制虚拟键盘的操作
    59   TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService,
    60   IInterface(FService_kb));
    61   if TPlatformServices.Current.SupportsPlatformService
    62   (IFMXVirtualKeyboardToolbarService, IInterface(FService))then
    63   begin
    64     FService.SetToolbarEnabled(true);
    65     FService.SetHideKeyboardButtonVisibility(true);
    66   end;
    67 end;
    68 
    69 end.
  • 相关阅读:
    数学--数论---欧拉筛 模板
    数学--数论--HDU 5019 revenge of GCD
    数学--数论--HDU 2674 沙雕题
    数学--数论--HDU 2104 丢手绢(离散数学 mod N+ 剩余类 生成元)+(最大公约数)
    数学--数论-- HDU -- 2854 Central Meridian Number (暴力打表)
    数学--数论--HDU 2197 本原串 (推规律)
    数学--数论--HDU 2582 F(N) 暴力打表找规律
    C# 命名规范
    文本分类学习 (十)构造机器学习Libsvm 的C# wrapper(调用c/c++动态链接库)
    文本分类学习 (九)SVM入门之拉格朗日和KKT条件
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/4781746.html
Copyright © 2011-2022 走看看