views:

1222

answers:

1

You know in iPhone, The four components of a typical iPhone application are a title bar, a navigation list, a destination page, and a button bar.

for The Title Bar The title bar includes the following elements: Back button: Screen title: Command button:

My question comes, although i can use UI framework tool, such as: Phonegap, iui, jtquery to develop web app, but i can't display the TitleBar effect in Android,

i can't use below code in Android: meta content="yes" name="apple-mobile-web-app-capable"

Actually, the above can work in Apple Safari Browser, but I can't use Safari to display our Android Project, which is i don't want to see.

Does anyone know how to fulfill this effect in Android, please help me, your help will be great appreciated.


to

"It's unclear if you developing a native android application or a webapp.

                                 – alexanderblom yesterday"

sorry that i forget to mention, i want to develop a iphone-webapp-style application in Android. Since it's too difficult, i want to use iWebkit, but it seems only work in apple iPhone OS or Safari which contain the specific engine to display the beautiful layout, like below:( -_-! i am new so i can't post images here)

alt text

+4  A: 

Hi edwar,

If I'm not mistaken, if you want to custom in any way the title bar at the top of your screen, you have to do several things :

First, read this thread about titlebar customisation, as it's quite detailled. Then, you have to add a few more things to it to match your requirements, all in the same xml file which will be your titlebar.xml:

-a button, on which listener you assign the same keyEvent as the normal back key of every android phone.

-a textview for whatever title you want to put in.

-a button for the command button, for whatever it does in Iphone (if you tell me what it does, maybe i'll be able to give more details)

Then, as I take it, you want to have it available on all your pages, without having to request titlebar customization on every activity, I would recommend you to use the same trick as I did : Define a superclass, which all your activities will extend. then you you requestwindowfeatures in this class, and do all your customization in this one.Finnaly, You just have to call the variable of your titlebar textview in the oncreate of all your subclasses to assign the string you want on each page. If your string is generated dynamically from, lets say a file name you load from the internetv in a background thread, you will need to define a handler to the main thread as you can't update a view from another thread than the one that has created it.

Hopes that helps. If you have any question about that, feel free to ask, i'll keep an eye on your topic, because I had quite a pain to make my titlebar work properly. good luck

Sephy