Chapter 2. 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 ...
Get Building Android Apps with HTML, CSS, and JavaScript, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.