Creating user interfaces with android (Part 2 of 2)
This is part 2 of an introduction to creating user interfaces for Android.
Styling
If you come from a web development background, you probably find it ugly to define styles inline. Luckily as with HTML and CSS, you can define your styles in an external file. The syntax is completely different so it may take some time to get used to, but I think of it as assigning classes to the elements I want to style and then defining their styles.
To create a stylesheet we need to create an XML file in the res/values/ directory, it should look something like this:
1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FillWidth">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources>