In previous article, it demonstrated how easy it is to port ZK on variety of platform depending on ZK's server-centric characteristic. In this article, I am going to introduce more HIL (Handset Interactive Language) components, and events, including frame, label, textbox, image, and button.
Following is the video of a ZK Mobile for Android client. It includes a URL textbox and two buttons. The "GO" button is used to open the URL while the other one will close the ZK Mobile for Android client itself.
From now on, in addition to ZUL, ZHTML, and MIL components, you have another choice to write your application with HIL (Handset Interactive Language) components. In the following paragraphs, I will introduce you the basic HIL components, and how they interact with each in ZK's event-driven way.
Labels and Image
Here is another example you might look familiar.
<frame title="Label and Image Demo" visible="true"> Do you love this photo? <image src="sun.jpg"/> <label id="ans"/> <button label="YES" onClick='ans.value="YES"'/> <button label="NO" onClick='ans.value="NO"'/> </frame>
As you could see, there doesn't exist much difference between it and ZUL. The major difference is that window component is replace of frame component since only one frame could be displayed at once. However, in addition to the above restriction, you could use HIL components in the same way with ZUL components.
The Textbox and onChanging event
The onChanging demo program.
<frame title="onChanging event demo" visible="true"> onChanging textbox: <textbox id="original" onChanging="copy.value = event.value"/> instant copy: <label id="copy"/> </frame>
You type on the textbox "original" and the result is reflected to label "copy" immediately.
Try It Yourself
1. Installing Android SDK, refer to installing the SDK
2. Installing the Android Eclipse Plug-in (ADT), refer to Installing the Eclipse Plug-in (ADT)
3. Download zkand-demo.war zkand-demo.war and deploy it to Tomcat and then start the Tomcat
4. Download zkand.zip and extract it to a folder
5. In Eclipse, click on 'File', select Import.../General/Existing Projects into Workspace. Hit the browse button, and navigate to where you placed the extracted folder, select zkand and click OK..
ZK Mobile for Android is no doubt an important feature since Android is a powerful client, we might realize the idea of off-line program on Android in the future. The ZK Team will keep on improving it and we hope you can give us feedbacks so we can make it better.
|Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.|