Expandable lists let you create lists within lists.
They’re ideal for list items that have sub-categories. The user selects an item from a scrollable list and another list pops open. They can then make another selection from this list.
It’s best to define your menus in XML in a menu resource file. However, sometimes you may want to create or modify a menu programmatically.
We’ll show you how to create and modify your menus in code.
We’re using the support library so that our code will work on devices running Android 2.1.x (API Level 7) and higher.
The Context class gives you access to the global information about an application’s environment. It lets you:
Don’t be confused by:
Check out these quick examples…
You use the TextView class to display text to the user.
Although you can also edit the text displayed in text views, it’s best to use the TextView subclass, EditText to do that.
The TextView class has a number of attributes that you can use to make your text really stand out. We’ll show you a few to whet your appetite.
Read on to see how to:
Linear layouts support a layout_weight attribute.
We can use the weight attribute to allocate a portion of the layout’s space to a view, depending on its weight.
All views have a default weight of 0.
You can set a weight attribute using a float value for any view that you use in a LinearLayout. Android will then divide the available space up amongst the views proportionately, depending on their weight values.
In the introduction, we covered the basics of using soft keyboards. If you haven’t read it yet, you’ll find it here: Android’s soft keyboard. An introduction.
In this tutorial, we’ll show you how to use the soft keyboard in your apps.
Need to capture text input in your app?
Android supports an on-screen soft keyboard as well as attached hardware keyboards.
The soft keyboard appears when a text field is in focus and disappears when it’s out of focus. The keyboard positions itself at the bottom of the screen over the app window. It has its own editing area.
In this introduction, we’ll cover the basics of using soft keyboards. Later, in a follow up tutorial, we’ll show you how to use the soft keyboard in your apps.
Android apps can be installed on devices around the world. If you want to distribute your app to this large market, then you should provide alternative resources such as text, sound and images.
Android makes it easy to include alternative strings, sound files, layouts and images so that your app will work in any country and in any language.
Our tutorial app will show you how to include alternative text and image resources.
Seek Bars are like Progress Bars, with a slight difference. The user determines the progress by moving a slider.
We’ll show you how to use a SeekBar to change the size of text in a TextView.