Basic Styling

Ultimately, we are going to build a native Android app using HTML, CSS, and JavaScript. The first step on this journey is to get comfortable styling HTML to look like a mobile app. In this chapter, I'll show you how to apply CSS styles to a bunch of existing HTML pages so that they are easily navigable on an Android phone. So, in addition to moving closer to building a native app, you'll be learning a practical (and valuable) skill that you can use immediately.

Don't Have a Website?

If you've been testing all your web pages locally on your personal computer, you won't be able to view them on your Android phone without setting up a server. You have a couple choices:

• Host your web pages on a web server and connect to that server from your Android phone. Chances are good that your Internet Service Provider (ISP) offers complimentary web hosting, but this usually only supports basic features such as HTML. By the time we get to Chapter 6, we're going to need to use PHP, a scripting language that runs on the web server, so you should look into an inexpensive hosting service. Many companies, such as Laughing Squid, offer entry-level hosting with PHP for under $10 a month.

• Host them on a web server running on your computer and connect to the web server running on your computer from your Android phone. This only works when your Android phone and computer are on the same WiFi network.

This chapter is set up so you can try the examples as you go through it. So, no matter which option you choose for viewing the web pages, try reloading them in a browser (preferably the Android browser) each time you add something new to one of the samples. However, be sure to save your file in your text editor before you reload it in the browser or you won't see your changes.

Running a Web Server Locally

All current mainstream operating systems (Linux, Windows, Mac OS X) include some sort of web server. On Mac OS X, open System Preferences, choose Sharing, and enable Web Sharing. Once you've started Web Sharing, the Web Sharing preferences will display the URL of your personal website (this includes anything you've put in the Sites directory in your home directory). It will be of the form http://local-hostname/ ~your-username.

On some versions of Linux, such as Ubuntu, you will need to go through some additional steps to install and enable a web server. First, install Apache at the command line with sudo aptitude install apache2. Next, enable the user directory module with sudo a2enmod userdir. Once that's done, restart Apache with this command: sudo /etc/init.d/apache2 restart. After you've done that, you can create a directory called public_html in your home directory and access any files in there with a URL such as http://local-hostname/~your-username.

On Windows, things are a little more involved. You need to be running a version of Windows that includes Internet Information Services (IIS) and enable it by going into the Control Panel and making your way to Turn Windows Features On or Off. After you've done this, put your web documents in your IIS document root, which is typically located at C:\inetpub\wwwroot. If you'd prefer to run Apache on Windows, check out a prepackaged solution such as EasyPHP, or check out the Wikipedia page on this topic at http://en.wikipedia.org/wiki/Comparison_of_WAMPs.

First Steps

Theory is great, but I'm a "show me, don't tell me" kinda guy so let's dive in.

Imagine you have a website that you want to "mobile-ize" (Figure 2-1). In this scenario, there are a number of easy things you can do to optimize a site for Android. I'll go over your options in this chapter.

Figure 2-2 shows what this web page looks like on the Android phone. It's usable, but far from optimized for Android.

Example 2-1 shows an abbreviated version of the website shown in Figure 2-2. This is the HTML you'll be working with in this chapter. You can download it from this book's website if you'd like to try styling it as you go through the chapter. The desktop stylesheet (screen.css) is not shown as it is not essential, but you can use the stylesheet from the previous chapter if you'd like to have something to play with.

About Blog Contact

Jonathan Stark

Consulting Clink On Call Development O'Reill-y Atedia, Inc.

About

Jonathan Stark Is a web developer, speaker, and author. His oonsulting Arm, Jonathan Stark Consulting. Inc., has attracted clients such as Nokia. Turner Broadcasting, and the PGA Tour.

Jonathan is the author of the book Building Android Adds with HTML. CSS, and JavaScript, is a regular speaker at leading industry conferences, and is often quoted In the metía on Internet and mobile ¡testae trBnds

Jonathan began his programming carBer more than 20 years ago on a Tancfy TRS-00 and still thinks Zork was a sweet game.

In his own words ha® former been interested in two things: computers and music. So. after spending the better part of my teens and twenties attempting to cultivate a career in music, I finally crossed ovBrtothedaiikSKle and tockadeskjob^agrj^rhic designer.

One thing led to another and the next thing I knew. I was making a nice llwng designing custom databaseandwebapplications for a prominent consulting company...

Abcut Hoc Contact

4 t3 ^ hrtp y/jonathansrark.com/androldyscreensliots/

Figure 2-1. Desktop version of a typical website looks fine in Chrome on a desktop

Example 2-1. The HTML document we'll be styling

<link rel="stylesheet" href="screen.css" type="text/css" /> <title>Jonathan Stark</title> </head> <body>

<div id="container"> <div id="header"> <hl><a href="./">Jonathan Stark</a></hl> <div id="utility"> <ul>

<li><a href="about.html">About</a></li> <li><a href="blog.html">Blog</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div>

<li><a href="consulting-clinic.html">Consulting Clinic</a></li> <li><a href="on-call.html">On Call</a></li> <li><a href="development.html">Development</a></li> <li><a href="http://www.oreilly.com">O'Reilly Media, Inc.</a></li> </ul> </div> </div>

<div id="content"> <h2>About</h2>

<p>Jonathan Stark is a web developer, speaker, and author. His consulting firm, Jonathan Stark Consulting, Inc., has attracted clients such as Staples, Turner Broadcasting, and the PGA Tour. </p>

<div id="sidebar"> <img alt="Manga Portrait of Jonathan Stark" src="jonathanstark-manga-small.png"/> <p>Jonathan Stark is a mobile and web application developer who the Wall Street Journal has called an expert on publishing desktop data to the web.</p> </div>

<li><a href="services.html">Services</a></li> <li><a href="about.html">About</a></li> <li><a href="blog.html">Blog</a></li> </ul>

<p class="subtle">Jonathan Stark Consulting, Inc.</p> </div> </div> </body> </html>

For years, web developers used tables to lay out elements in a grid. Advances in CSS and HTML have rendered that approach not only obsolete, but undesirable. Today, we primarily use the div element (along with a variety of attributes) to accomplish the same thing, but with more control. Although a complete explanation of div-based layouts is well outside the scope of this book, you'll see plenty of examples of it as you read through the book. To learn more, please check out Designing with Web Standards by Jeffrey Zeldman (New Rider Press), which covers the issue in greater detail.

Figure 2-2. Desktop version of a typical website looks all right on an Android phone, but we can do a lot better

Prepare a Separate Android Stylesheet

I'm as DRY as the next guy, but in the real world you're better off making a clean break between your desktop browser stylesheet and your Android stylesheet. Take my word for it and just make two completely independent files; you'll sleep better. The alternative is to wedge all of your CSS rules into a single stylesheet, which is a bad idea for a number of reasons, the most obvious of which is that you'd be sending a bunch of irrelevant desktop style rules to the phone, which is a waste of precious bandwidth and memory.

DRY stands for "don't repeat yourself," and is a software development principle that states, "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." The term was coined by Andrew Hunt and David Thomas in their book The Pragmatic Programmer (Addison-Wesley Professional).

To specify a stylesheet specifically for Android, replace the stylesheet link tag in the sample HTML document with ones that use the following expressions:

<link rel="stylesheet" type="text/css"

href="android.css" media="only screen and (max-width: 480px)" /> <link rel="stylesheet" type="text/css"

href="desktop.css" media="screen and (min-width: 48lpx)" />

I specifically used max-width and min-width here so that you can resize your desktop browser and see the mobile version of the page. If you would prefer to serve the desktop.css stylesheet to desktop users regardless of their browser window size, use max-device-width and min-device-width instead.

The Wireless Universal Resource File (WURFL) contains information you can use to identify a huge number of wireless devices, including Android devices. If you need to detect Android devices with a width greater than 480px (such as a tablet) or if you don't want the mobile version of the site to appear when users resize their browser window below 480px, you can use WURFL's PHP API to precisely detect specific browsers. See the Appendix for more information on WURFL.

Here, desktop.css refers to your existing desktop stylesheet, and android.css is a new file that we'll be discussing in detail in a bit. The desktop.css file is not essential, but you can use the stylesheet from the previous chapter if you'd like.

If you're following along using the sample HTML document shown in Example 2-1, you'll need to rename screen.css to desktop.css, but since we're focused on the Android stylesheet, you can ignore the desktop stylesheet completely. If it fails to load, your browser won't get too upset.

However, if you'd like to use Chrome to test the Android-optimized version of the site, you should replace the reference to desktop.css with a reference to android.css. That way, you'll get to run the Android version of your site whether you load it from a phone or the desktop browser.

Regrettably, Internet Explorer will not understand these expressions, so we have to add a conditional comment (shown in bold) that links to the desktop version of the CSS:

<link rel="stylesheet" type="text/css"

href="android.css" media="only screen and (max-width: 480px)" /> <link rel="stylesheet" type="text/css"

href="desktop.css" media="screen and (min-width: 481px)" /> <!--[if IE]>

<link rel="stylesheet" type="text/css" href="explorer.css" media="all" /> <![endif]-->

So now it's time to edit the HTML document (if you haven't already done that as you were following along): delete the existing link to the screen.css file, and replace it with the lines just shown. This way, you will have a clean slate for the Android-specific CSS in this chapter.

Control the Page Scaling

Unless you tell it otherwise, the Android browser will assume your page is 980px wide (Figure 2-3). In the majority of cases, this works great. However, you are going to format the content specifically for the smaller dimensions of the Android phone, so you must let the mobile browser know about it by adding a viewport meta tag to the head element of the HTML document:

<meta name="viewport" content="user-scalable=no, width=device-width" />

Desktop browsers will ignore the viewport meta tag, so you can include it without worrying about the desktop version of your site.

H http://jonathanstark.co... m

Jonathan Stark

Jonathan Stark

Figure 2-3. Android assumes a normal web page is 980px wide

Merely by suppressing the desktop stylesheet and configuring your viewport, you will have already given your Android users an enhanced experience (Figure 2-4). To really impress them, let's start building the android.css stylesheet.

O http://jonathanstark.co... ^

Jonathan Stark

• Consulting Clinic

• Development

About

Jonathan Stark is a web developer, speaker, and author. His consulting firm, Jonathan Stark Consulting, Inc., has attracted clients such as Nokia, Turner Broadcasting, and the PGA Tour.

Jonathan is the author of the book Building Android Apps with HTML, CSS, and lavaScript, is a regular speaker at

Figure 2-4. Setting the viewport to the width of the device makes your pages a lot more readable on Android

If you don't set the viewport width, the page will be zoomed out when it first loads. It's tough to say exactly what the zoom level will be because the Android browser includes a setting that allows users to set the default zoom. The options are Far, Medium (the default), or Close. Even if you do set the viewport width, these user-defined settings will affect the zoom level of your app.

Adding the Android CSS

There are a number of UI conventions that make an Android app look like an Android app. In the next section, we'll add the distinctive title bar, lists with rounded corners, finger-friendly links that look like glossy buttons, etc. With the text editor of your choice, create a file named android.css and add the code shown in Example 2-2 to it, then save the file in the same directory as your HTML document.

Example 2-2. Setting some general site-wide styles on the HTML body element body {

background-color: #ddd; /* Background color */

font-family: Helvetica;

font-size: 14px;

margin: 0; /* Amount of negative space around the outside of the body */ padding: 0; /* Amount of negative space around the inside of the body */

All text on Android is rendered using a custom font named Droid. The Droid font family was specifically built for mobile devices, has excellent character set support, and contains three variants: Droid Sans, Droid Sans Mono, and Droid Serif. Therefore, specifying a font family of Helvetica as we've done here will only have an effect on devices other than Android.

Now let's attack the header div that contains the main home link (i.e., the logo link) and the primary and secondary site navigation. The first step is to format the logo link as a clickable title bar. Add the following to the android.css file:

background-color: #ccc; border-bottom: 1px solid #666; color: #222; display: block; font-size: 20px; font-weight: bold; padding: 10px 0; text-align: center; text-decoration: none;

We'll format the primary and secondary navigation ul blocks identically, so we can just use the generic tag selectors (i.e., #header ul) as opposed to the tag IDs (i.e., #header ul#utility, #header ul#nav):

list-style: none; margin: 10px; padding: 0;

background-color: #FFFFFF; border: 1px solid #999999; color: #222222;

display: block; font-size: 17px; font-weight: bold; margin-bottom: -1px; padding: 12px 10px; text-decoration: none;

Pretty simple so far, right? With this little bit of CSS, we have already made a big improvement on the Android page design (Figure 2-5). Next, add some padding to the content and sidebar divs to indent the text from the edge of the screen a bit (Figure 2-6):

#content, #sidebar { padding: 10px;

You might be wondering why we're adding padding to the content and sidebar elements instead of setting it globally on the body element itself. The reason is that it's very common to have elements displayed edge to edge (as with the header in this example). Because of this, padding applied to the body or some other element that's wrapped around lots of others can become more trouble than it's worth.

Figure 2-5. A little bit of CSS can go a long way toward enhancing the usability of your Android app

Contact

Consulting Clinic

On Call

Development

O'Reilly Media, Inc.

About

Jonathan Stark is a web developer, speaker, and author. His consulting firm, Jonathan Stark Consulting, Inc., has attracted clients such as Nokia, Turner Broadcasting, and the PGA Tour.

Jonathan Is the author of the book Building Android Apps with HTML. CSS, and lavaScript, is a regular speaker at leading industry conferences, and is often quoted in the media on internet and mobile lifestyle trends

Jonathan began his programming career more than ?n vparc nun iin a T;*nrlv TP^-RO and still

Figure 2-6. Indenting text from the edges

The content in the footer of this page is basically a rehash of the navigation element (the ul element with the ID nav) at the top of the page, so you can remove the footer from the Android version of the page by setting the display to none, as follows:

display: none;

Adding the Android Look and Feel

Time to get a little fancier. Starting from the top of the page, add a 1-pixel white drop shadow to the header text and a CSS gradient to the background:

text-shadow: 0px 1px 1px #fff;

background-image: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#999));

Adding the Android Look and Feel | 23

In the text-shadow declaration, the parameters from left to right are: horizontal offset, vertical offset, blur, and color. Most of the time, you'll be applying the exact values shown here to your text because that's what usually looks good on Android, but it is fun to experiment with text-shadow because it can add a subtle but sophisticated touch to your design.

On most browsers, it's fine to specify a blur radius of 0px. However, Android requires you to specify a blur radius of at least 1px. If you specify a blur of 0, the text shadow will not show up on Android devices.

The -webkit-gradient line deserves special attention. It's an instruction to the browser to generate a gradient image on the fly. Therefore, you can use a CSS gradient anywhere you would normally specify a url() (e.g., background image, list style image). The parameters from left to right are as follows: the gradient type (can be linear or radial), the starting point of the gradient (can be left top, left bottom, right top, or right bottom), the end point of the gradient, the starting color, and the ending color.

You cannot reverse the horizontal and vertical portions of the four gradient start and stop point constants (i.e., left top, left bottom, right top, or right bottom). In other words, top left, bottom left, top right, and bottom right are invalid values.

The next step is to add the traditional rounded corners to the navigation menus:

#header ul li:first-child a {

-webkit-border-top-left-radius: 8px; -webkit-border-top-right-radius: 8px;

#header ul li:last-child a {

-webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px;

As you can see, we're using corner-specific versions of the -webkit-border-radius property to apply an 8-pixel radius to both the top two corners of the first list item and the bottom two corners of the last list item (Figure 2-7).

It would be cool if you could just apply the border radius to the enclosing ul, but it doesn't work. If you try it you'll see that the square corners of the child list items will overflow the rounded corners of the ul, thereby negating the effect.

Technically, we could achieve the rounded list effect by applying the radius corners to the ul, if we set the background color of the ul to white and set the background of its child elements to transparent. However, when users click the first or last items in the list, the tap highlight will show up squared-off and it looks terrible. Your best bet is to apply the rounding to the a tags themselves as I've demonstrated here.

ffijaflOB76" 1:15pm

O http://jonathanstark.co... Q

Jonathan Stark

About

Blog

Contact

Consulting Clinic

On Call

Development

O'Reilly Media, Inc.

About

Figure 2-7. Gradients, text shadows, and rounded corners start to transform your web page into a native-looking Android app

The occurrences of first-child and :last-child above are called pseudoclasses. Pseudoclasses are a special type of CSS selector that allow you to target elements that meet certain implicit contextual criteria. In other words, you can style things based on characteristics—such as where they are in a list, whether they have cursor focus, or if they have been clicked—without having to manually update your markup. For example, li:first-child will select the first li that is the child of its ul parent. Without the code pseudoclass, we'd have to manually add a class to the first li to let the browser know that it was the first one.

Adding Basic Behavior with jQuery

The next step is to add some JavaScript to the page to support some basic dynamic behavior. In particular, we will allow users to show and hide the big honking navigation section in the header so that they only see it when they want to. To make this work, we'll write some new CSS and use some JavaScript to apply the new CSS to the existing HTML.

First, let's take a look at the new CSS. Step 1 is to hide the ul elements in the header so they don't show up when the user first loads the page. If you are following along at home, open your android.css file and add the following:

#header ul.hide { display: none;

This won't actually hide anything until you add the hide class to the ul elements (you'll do this shortly with some JavaScript). Next, define the styles for the button that will show and hide the menu. We haven't created the HTML for the button yet. For your information, it's going to look like this:

<div class="leftButton" onclick="toggleMenu()">Menu</div>

I'll describe the button HTML in detail in the section "Adding Basic Behavior with jQuery" on page 28, so don't add the preceding line of code to your HTML file. The important thing to understand is that it's a div with the class leftButton and it's going to be in the header.

Here is the CSS style for the button (you can go ahead and add this to the android.css file):

#header div.leftButton { position: absolute;© top: 7px; left: 6px; height: 30px; font-weight: bold; text-align: center; color: white;

text-shadow: rgba (0,0,0,0.6) 0px -1px 1px; line-height: 28px;© border-width: 0 8px 0 8px;©

-webkit-border-image: url(images/button.png) 0 8 0 8;

* > For the graphics used in this chapter, you can download the example files from http://examples.oreilly.com/catalog/9781449383268 and copy ' ' f Jt* them from the images directory. Put these copies into an images subdirectory beneath the directory that contains your HTML document (you'll probably need to create the images directory). We'll be talking about jQTouch in detail in Chapter 4.

O Taking it from the top, set the position to absolute to remove the div from the document flow. This allows you to set its top and left pixel coordinates.

© Set the height to 30px so it's big enough to tap easily.

© Style the text bold, white with a slight drop shadow, and centered in the box.

O In CSS, the rgb function is an alternative to the familiar hex notation typically used to specify colors (e.g., #FFFFFF). rgb(255, 255, 255) and rgb(l00%, 100%, 100%) are both the same as #FFFFFF. More recently, the rgba() function has been introduced, which allows you to specify a fourth parameter that defines the alpha value (i.e., opacity) of the color. The range of allowable values is 0 to 1, where 0 is fully transparent and 1 is fully opaque; decimal values between 0 and 1 will be rendered translucent.

© The line-height declaration moves the text down vertically in the box so it's not flush against the top border.

© The border-width and -webkit-border-image lines require a bit of explanation. These two properties together allow you to assign portions of a single image to the border area of an element. If the box resizes because the text increases or decreases, the border image will stretch to accommodate it. It's really a great thing because it means fewer images, less work, less bandwidth, and shorter load times.

The border-width line tells the browser to apply a 0 width border to the top, an 8px border to the right, a 0 width border to the bottom, and an 8px width border to the left (i.e., the four parameters start at the top of the box and work their way around clockwise). You don't need to specify a color or style for the border.

O With the border widths in place, you can apply the border image. The five parameters from left to right are: the URL of the image, the top width, the right width, the bottom width, and the left width (again, clockwise from top). The URL can be absolute (http://example.com/myBorderImage.png) or relative. Relative paths are based on the location of the stylesheet, not the HTML page that includes the stylesheet.

When I first encountered the border image property, I found it odd that I had to specify the border widths when I had already done so with the border-width property. After some painful trial and error, I discovered that the widths in the border-image property are not border widths; they are the widths to slice from the image. Taking the right border as an example, I'm telling the browser to take the left 8px of the image and apply them to the right border, which also happens to have an 8px width.

It is possible to do something irrational such as applying the right 4 pixels of an image to a border that is 20px wide. To make this work properly, you have to use the optional parameters of webkit-borderimage that instruct the image what to do with the slice in the available border space (repeat, stretch, round, etc.). In three years of trying, I have failed to come up with any sane reason to do this, so I won't waste space here describing this confusing and impractical option of an otherwise killer feature.

Okay, time for some JavaScript. In preparation for the JavaScript you're about to write, you need to update your HTML document to include jquery.js and android.js. Add these lines to the head section of your HTML document:

<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="android.js"></script>

* > jQuery downloads, documentation, and tutorials are available at http:

lljquery.com. To use jQuery, you will need to download it from there, • $ rename the file you downloaded (such as jquery-13.2.min.js) to jquery.js, and put a copy of it in the same directory as your HTML document.

The primary duty of the JavaScript in android.js is to allow users to show and hide the nav menus. Copy the following JavaScript into a file called android.js and save it in the same folder as the HTML file:

if (window.innerWidth && window.innerWidth <= 480) { O $(document).ready(function(){

$('#header ul').addClass('hide'); © $('#header').append('<div class="leftButton" onclick="toggleMenu()">Menu</div>'); O

function toggleMenu() {

$('#header .leftButton').toggleClass('pressed'); ©

O The entire block of code is wrapped in an if statement that checks to make sure the innerWidth property of the window object exists (it doesn't exist in some versions of Internet Explorer) and that the width is less than or equal to 480px (a reasonable maximum width for the most phones). By adding this line, we ensure that the code executes only when the user is browsing the page with a typical Android phone or some other similarly sized device.

If you are testing your Android web pages using the desktop version of Chrome as described in "Don't Have a Website?" on page 13, the if statement here will fail if your browser's window width is too large. Manually resize your window to be as narrow as possible and refresh the page.

Here we have the so-called "document ready" function. If you are new to jQuery, this can be a bit intimidating, and I admit that it took me a while to memorize the syntax. However, it's worth taking the time to commit it to memory, because you'll be using it a lot. The document ready function basically says, "When the document is ready, run this code." More on why this is important in a sec.

© This is typical jQuery code that begins by selecting the uls in the header and adding the hide CSS class to them. Remember, hide is the selector we used in the CSS above. The net effect of executing this line is to, well, "hide" the header ul elements.

Had we not wrapped this line in the document ready function, it would have most likely executed before the uls were even finished loading. This means the JavaScript would load, and this line would fail because the uls wouldn't exist yet. Then, the page would continue loading, the uls would appear, and you'd be scratching your head (or smashing your keyboard), wondering why the JavaScript wasn't working.

O Here is where we append a button to the header that will allow the user to show and hide the menu (Figure 2-8). It has a class that corresponds to the CSS we wrote previously for .leftButton, and it has an onclick handler that calls the function toggleMenu() that comes next.

H http://jonathanstark.co...

Jonathan Stark

About

Jonathan Stark is a web developer, speaker, and author. His consulting firm, Jonathan Stark Consulting, Inc., has attracted clients such as Nokia, Turner Broadcasting, and the PGA Tour.

Jonathan Is the author of the book Building Android Apps with HTML, CSS, and JavaScript, is a regular speaker at leading Industry conferences, and is often quoted in the media on internet and mobile lifestyle trends

Jonathan began his programming career more than 20 years ago on a Tandy TRS-80 and still thinks Zork was a sweet game.

In his own words

I have forever been Interested in two things: computers and music. So, after spending the better part of my teens and twenties attempting to cultivate a career in music, I

Figure 2-8. The Menu button has been added to the toolbar dynamically using jQuery

© The toggleMenu()function uses jQuery's toggleClass() function to add or remove the specified class to the selected object. On this line, we toggle the hide class on the header uls.

© Here, we toggle the pressed class on the header leftButton.

Come to think of it, we haven't written the CSS for the pressed class yet, so let's do so now. Go back to android.css and insert the following:

#header div.pressed {

-webkit-border-image: url(images/button_clicked.png) 0 8 0 8;

As you can see, we're simply specifying a different image for the button border (it happens to be slightly darker). This will add a two-state effect to the button that should make it evident to the user that the button can both show and hide the menu (Figure 2-9). Figure 2-10 shows a stretched-out view of the page showing both the menu and some of the text.

0 http://jonathanstark.co... M

Ejjl Jonathan Stark

_

About

Blog

Contact

Consulting Clinic

On Call

Development

O'Reilly Media, Inc.

About

Figure 2-9. The Menu button displays darker when it has been pressed

Jonathan Stark toiäl Jonathan Stark

About

Blog

Contact

Consulting Clinic

On Call

Development

O'Reilly Media, Inc.

About

Jonathan Stark is a web developer, speaker, and author. His consulting firm, Jonathan Stark Consulting, Inc., has attracted clients such as Nokia, Turner Broadcasting, and the PGA Tour.

Jonathan is the author of the book Building Android Apps with HTML. CSS, and JavaScript. is a regular speaker at leading industry conferences, and is often quoted in the media on internet and mobile lifestyle trends

Jonathan began his programming career more than 20 years ago on a Tandy TRS-80 and still thinks Zork was a sweet game.

Fn his own words

I have forever been interested in two things: computers and music. So, after spending the A better part of my teens and twenties attempting T

Figure 2-10. A tall view of the completed basic Android CSS

What You've Learned

In this chapter, we covered the basics of converting an existing web page to a more Android-friendly format. We even used a bit of dynamic HTML to show and hide the navigation panels. In the next chapter, we'll build on these examples while exploring some more advanced JavaScript concepts; in particular, some yummy Ajax goodness.

CHAPTER 3

0 0

Post a comment