Secret for Windows Phone development for Android Developers (1)

Source: Internet
Author: User

BKJIA headlines: similar to Android mobile apps, Windows Phone 7WP7) apps are also written in hosting languages. Android uses Java and Windows Phone 7 uses C #, each of them provides a wide range of development libraries. Many differences between Java and C # are related to styles, which are closely related to C/C ++, therefore, they have many similarities.

There are many differences between. NET/Windows Phone 7 and Java/Android APIs, but the similarities between the two allow you not to spend too much effort on porting applications.

Platform differences

Before learning more about tools and processes related to converting or creating Windows Phone 7 applications, let's briefly introduce the terms and technologies used by Windows Phone 7 and Android. Windows Phone 7's first major difference is that applications are hosted. NET Assembly written in C #. The platform supports two types of applications: Silverlight and XNA games.

Most Windows Phone 7 applications are created using Silverlight and provide typical form-based user interaction through common controls, such as labels, text boxes, and lists, android Layout and Activity are similar to pages in Silverlight.

Windows Phone 7 also supports XNA, which allows users to create 2D and 3D games. They are equivalent to the 2D and 3D modes of Android SurfaceView and GLSurfaceView, but unlike Android, XNA Games use Direct3D, making it easier to port PC and Xbox 360 games to mobile phones, while Android uses OpenGL.

Page) and Navigation)

Silverlight Page is actually an XML file, which is similar to Android Layout. XML creates a Page using the XAML eXtensible Application Markup Language when defining it. XAML is similar to Android Layout, however, it supports more functions. XAML allows developers to perform operations on pages, including Animations and Data Binding. Therefore, you do not need to write code for these functions.

Android Layout and Activity are loosely coupled. You need to write your own code to connect to the UI elements in the Activity. For a given Page, C # The code is bundled with it, so you do not need to write the UI ancillary elements. The platform will automatically create related "lines" for the object and create related events for the Page and UI, this can prevent frequent confusion in the Task onCreate method.

Another important difference between the two platforms is Navigation. In Android, you can switch from one task to another by creating an Intent, which has the same function as Navigation in Windows Phone 7, navigation allows you to move between pages. Similar to Android Intent, You can transmit data to the Page you want to navigate to, pages and ASP in Windows Phone 7.. NET Page has some similar properties.

Convert Layout to Page

Before learning more about the code, let's take a look at how Android Layout XML converts to Windows Phone 7 XAML Page. In the free toolbox of Windows Phone 7, the most dazzling one is the XAML design tool, Visual Studio®The XAML designer in 2010 is only suitable for junior developers. It can only perform some basic control on the Page, Expression Blend®It is a specialized tool. You should use it when you need to transform the UI. Like Android Layout, you can also use a text editor to directly edit the XAML file, because it is actually an XML file.

Windows Phone 7 Page provides Layout capabilities similar to Android Layout. The following table lists the Layout attributes supported by Windows Phone 7 Page and Android attributes.

Layout Control

Windows Phone 7

Android

Canvas

AbsoluteLayout

Grid

GridView

ScrollView

ScrollView

StackPanel

LinearLayout

As you can see, Windows Phone 7 provides almost the same layout capability as Android. The following table lists the basic controls of Windows Phone 7 and the same controls of Android.

Basic controls

Windows Phone 7

Android

TextBlock

TextView

TextBox

EditText

Button

Button

CheckBox

CheckBox

RadioButton

RadioButton

Image

ImageView

ProgressBar

ProgressBar

ListBox

ListView

Map

MapView

WebBrowser

WebView

You should note that the basic controls of Windows Phone 7 can correspond to the Layout type one by one, but some special Layout and controls cannot match. The reason is that the strong XAML, we can embed another control in one control, which means that you do not need to create complicated controls, which can be created and customized in your application.


Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.