There are situations where you need to map the same type to a different class implementation, or use an example of a drawing.
IShape, Rectangle, MyRectangle, MySQUARE, have the following inheritance relationship:
We may need to map ishape to
I explained the lifecycle of the Android activity in the previous section, and I'll explain the service, and first we need to know what the service is for. And the life cycle of it.
Service Concept and use:
Android services, it is different from
The concept of a task
A task is a stack of activities. A Task is a stack that contains a lot of activity, which follows the principle of LIFO. In one application, the activity that the user opens successively enters the task.
Look at an example:
The best way to understand ContentProvider is to try it yourself. The following describes how to use a built-in contacts contentprovider.
1. Create a project, Provider.
2. Code in the Main.xml.
On my device, the default preference name is Net.manoel.UsingPreferences_preferences.xml, which is prefixed with the name of the package. However, it is also useful to define a special name for a preference item. You can do this in the following way.
WebView allows you to embed a Web browser in your activity. This is useful if you need to embed some Web content in your application.
The following shows how to load content in a Web page in an activity by encoding.
1. A new project, WebView.
2.
The AnalogClock view shows a mock clock, which has an hour hand and a minute hand. In contrast to the DigitalClock view, it can display a digital analog clock. These two views can only display system time and not allow time for a particular time
The GridView is a sliding two-dimensional view of the plane. Usually, use the GridView to show some pictures. The following shows how to use the GridView.
1. Create a project, Grid.
2. Put some pictures under the res/drawable-mdpi.
3. Code in the
The previous section describes how to combine the use of gallery and ImageView. However, sometimes when you click a picture in gallery, you may not want a picture to "suddenly" appear in the ImageView. For example, you might want to set some toggle
Sometimes, the programs we do need to provide some options to enable users to customize their own style of use. For example, you might allow users to automatically save login information, allow users to set a page refresh time, and so on. On the
Listframgent is a fragment containing ListView that displays a range of information through a data source (array or cursor). Listfragment is very useful, like RSS, may display a list on the left, the right to display the selected list of the
Button,imagebutton,edittext,chcekbox,togglebutton
In addition to the most commonly used textview,android, some other basic controls are provided.
Button
ImageButton
EditText
CheckBox
Radiogroup and RadioButton
ToggleButton
The following
When you create a new Android project, Eclipse usually creates a main.xml file that contains a element.
TextView is used to present text messages to users. This is the most basic control that you will always use
In the previous section, menu options are not text. If you want to display both icons and text together, you can use the "|" and Menuitem.show_as_action_with_text constants.
MenuItem mnu1 = menu.add (0, 0, 0, "Item 1");
{
Mnu1.
Occasionally, you may want to make sure that your application shows up in a certain direction, horizontal screen mode or vertical screen mode. For example, you might develop a game that runs only under horizontal screen mode. In this case, you can
If you want to customize the UI according to the direction of the screen, in addition to anchoring the views to the screen for four weeks (the "anchoring" view in the previous section), it is easier to create a separate Res/layout folder that
The Using relativelayout makes it easy to implement anchored views. Observe the following Main.xml file, which contains 5 button that is embedded in :
Note the following properties, which are used on a different button:
The
ScrollView is a special framelayout that allows users to scroll through a list of views that can be used to make more space than the physical display area. One thing to note is that ScrollView can only contain one view or ViewGroup (this viewgroup
Tablelayout can organize views into rows or columns. You can use the element to specify a row in the table. Each row can also contain one or more views. Each view in each row makes up one element of the table. The width of each column is determined
V. Specify information related to the drive
Although it is not necessary to specify this information, a complete Linux driver will specify these driver-related information. It is generally necessary to specify the following information for the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service