《Microsoft_Press_eBook_Xamarin_Preview_2_PDF》中文摘要(持续更新中)

内容来自谷歌翻译+个人理解,因联系不上原作者,完全翻译有可能涉及版权,所以摘录一些精要。

方便自己和他人交流参考学习,期待大家一块翻译剩下的(排版没来得及折腾,见谅)。

环境:破解版Xamarin for Visual Studio 3.9.547,点我查看下载地址

(备注:只有windows版本,没有相应mac破解,不过对于学习来说足够了)

第一章:xamarin.forms适合什么情况?
1.oc,java,c#都是起源于c,所以有共同的地方。

(These three languages are cousins because they are all object-oriented descendants of C, but they
have become rather distant cousins.
) 

2.c#份额继续增长着,前途一片光明,通用的东西,linq,lambda表达式,异步都使得它成为一门经典语言。更令人激动的是,.net在2014.4.3build大会上,c#创建者AndersHjlsberg宣布.net以前项目roslyn开源。(But C# has continued to grow and get better over the years. The support of generics, lambda functions, LINQ, and asynchronous operations has successfully elevated C# to be classified as a multiparadigm programming language.
)
3.底层c#只支持基础的数据类型,int,double,string,但是拓展的.net框架支持很多,它们包括。
At the lowest
level, .NET provides an infrastructure for the C# basic data types (int, double, string, and so forth).
But the extensive .NET Framework class library provides support for many common chores encountered in many different types of programming. These include:
? Math
? Debugging
? Reflection
? Collections
? Globalization
? File I/O
? Networking
? Security
? Threading
? Web services
? Data handling
? XML and JSON reading and writing
4.share code,mvc->mvvm.view里包含ui和对于ui的操作,vm只是管理数据。MVVM separates code into the Model (the underlying data), the View (the user interface, including visuals and input), and the ViewModel (which manages data passing between the Model and the View).
5.c#->中间语言IL->oc。

When the iPhone app is built, the Xamarin C# compiler generates C# Intermediate Language (IL) as
usual, but it then makes use of the Apple compiler on the Mac to generate native iPhone machine
code just like the Objective-C compiler. The calls from the app to the iPhone APIs are the same as
though the application were written in Objective-C.
6. xamarin.forms从某种意义来说就是在各个平台建了个虚拟机。In one sense, Xamarin.Forms is an API that virtualizes the user-interface paradigms on each platform.
7.设置字体属性,不能同时设置粗体和斜体,只能设置其中一个。FontAttributes = FontAttributes.Italic,

8.局限性。xamarin.forms注重提取三个平台共有的原生组件,矢量图形或者复杂的触控交互还是采用原生的好。(For the most part, Xamarin.Forms defines its abstractions with a focus on areas of the mobile user interface that are common to iOS, Android, and Windows Phone. These Xamarin.Forms visual objects are
mapped to platform-specific objects, but Xamarin.Forms has tended to avoid implementing anything
that is unique to a particular platform.)

9.做产品原型很棒。Xamarin.Forms is great for prototyping or making a quick proof-of-concept application. And after you’ve done that, you might just find that you can continue using Xamarin.Forms
features to build the entire application. Xamarin.Forms is ideal for line-of-business applications.
10. 开发环境,vs2013+mac或者,mac下装vs的虚拟机开发。This means that if you want to target all three platforms in a single IDE, you can do so with Visual
Studio running on a PC connected to the Mac via a network. Another option is to run Visual Studio in a
virtual machine on the Mac.
11.如果想自己测试更多真实设备,可以关注 Xamarin Test Cloud.

chapter 1 翻译

第二章,剖析app。
1.xamarin.forms已经有了三个类可供使用(目前破解版的3.9.525没法使用?),The Xamarin.Forms application programming interface (API) defines classes named VisualElement, Page, Layout, and View.
2.很多xamarin程序员更喜欢用c#3.0的规范写代码。(我们还有别的选择吗?似乎只有一个模板可以使用) Many Xamarin.Forms programmers prefer to use the C# 3.0 style of object creation and property
initialization in their page constructors. Following the Label constructor, a pair of curly braces enclose
one or more property settings separated by commas.
3.ios有个距离顶部20像素需要处理。 A little research in your favorite search engine will reveal that the iOS status bar has a height of 20.
(Twenty what? you might ask. Twenty pixels? Actually, no. For now, just think of them as 20 “units.” For
most Xamarin.Forms programming you shouldn’t need to bother with numeric sizes, but Chapter 5,
“Dealing with sizes,” will provide some guidance when you need to get down to the pixel level.)
解决方法:①条件
#if __IOS__
Padding = new Thickness(0, 20, 0, 0);
#endif
②完美(device.onplatform(ios,android,winphone)):
 Padding = new Thickness( Device.OnPlatform( 200,50 , 5), 5, 5 , 5);
4.水平垂直提供8种对齐方式。HorizontalOptions and VerticalOptions提供了8种状态。如下? Start
? Center
? End
? Fill
? StartAndExpand
? CenterAndExpand
? EndAndExpand
? FillAndExpand
5.文字重于形式。注重排版。
6.label设置了verticaloptions后,YAlign将不起作用。能设置BackgroundColor = Color .Yellow,
TextColor = Color .Green。//不过效果不太好。
(the result with this single line of text is the same as setting HorizontalOptions and
VerticalOptions to Center, and you can also use various combinations of these properties to position the text in one of nine different locations around the page
)

chapter 2 翻译

1.水平和垂直对其默认属性不是左对齐,而是默认填满。The default value of HorizontalOptions and VerticalOptions is not LayoutOptions.Start,
as the default appearance of the text might suggest. The default value is instead LayoutOptions.Fill.
2.设置color.transparent意味着默认值,安卓下黑色,ios白色。但是设置其他颜色的时候要慎重,因为有可能设置的颜色属性,每个系统对于同样颜色解析出来不同。But don’t try to just ignore all the platform defaults and explicitly set all the colors in your application to your own color scheme. This probably won’t work as well as you hope because many views use
other colors that relate to the color theme of the operating system but that are not exposed through
Xamarin.Forms properties.
3.关于设置fontfamily,是个麻烦事,因为有些字体某些平台木有。The hardest of these to use is FontFamily. In theory you can set it to a font family name such as
“Times Roman,” but it will work only if that particular font family is supported on the particular platform. For this reason, you’ll probably use FontFamily in connection with Device.OnPlatform, and
you’ll need to know each platform’s supported font family names. For this reason, a demonstration of
FontFamily must await a future chapter.
4.formattedtext是格式化的text。可以自定义每一段字体的样式,eg:
             var myFormattedString=new FormattedString();
            var sp= new Span {Text = "aaa" , ForegroundColor = Color .Green};
            var sp1 = new Span { Text = "bbb", ForegroundColor = Color.Red };

new Label
                    {
                        FormattedText =   myFormattedString,
//                        Text = "Greetings, Xamarin.Forms!",
XAlign = TextAlignment .Center,
YAlign = TextAlignment .Center,
                    }
5.Text = "cc\u2019aaa\u2003ddddd"//cc‘aaa dddd
6.默认的字体大小不是像素而是单位。These are not pixel sizes! As with the height of the iOS status bar, it’s best to refer to these sizes only
vaguely as some kind of “units.”

chapter 3 细说文本

时间: 2024-11-01 14:11:49

《Microsoft_Press_eBook_Xamarin_Preview_2_PDF》中文摘要(持续更新中)的相关文章

Android 系统中,那些能大幅提高工作效率的 API 汇总(持续更新中...)

前言 "条条大路通罗马."工作中,实现某个需求的方式往往不是唯一的,这些不同实现方式不仅表现在代码质量上,还影响着我们的工作效率.就像,在 Android 系统中,总有那么一些鲜为人知的 API 能够减少我们很多零碎的工作量.于是,就想凭着一些经验,整理一些常用的,找个地方归纳总结,也供日后翻阅. getResources().getIdentifier(String name, String defType, String defPackage) 根据资源名称获取资源 id.正常情况

[系列汇总] - 二十三种设计模式(持续更新中…)

摘要 最近在读GOF的Design Patterns: Elements of Reusable Object-Oriented Software(设计模式:可复用面向对象软件的基础),学习前辈们的经验来增加自己的编码设计能力.在学习的过程中,会把我从书上学到的知识以及自己的理解写到这里.一方面能够巩固自己学到的东西同时方便以后的复习,另一方面是希望能够帮助到那些跟我一样不大了解设计模式的人. 我理解的设计模式不是一套固定的代码,更多的是一种设计理念.它能够帮助我们解决特定的设计问题,使我们的程

痞子衡嵌入式:史上最强i.MX RT学习资源汇总(持续更新中...)

大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是i.MX RT学习资源. 类别 资源 简介 官方汇总 i.MXRT产品主页 恩智浦官方i.MXRT产品主页,最权威的资料都在这里,参考手册/数据手册,官方EVK板设计文件,各种应用笔记,各种参考设计方案.培训视频.软件SDK开发包,官方IDE/CFG工具,第三方软件支持等应有尽有,如果这上面文档你都能全部仔细看一遍,软件都能下载用起来,不用怀疑,你就是资深专家了. 其中痞子衡特别推荐你把所有应用笔记都看一遍,这些笔记凝结了所有恩智浦

linux学习资料持续更新中

一.LINUX基础教程 1.老男孩系列免费视频: 1) linux高薪入门实战视频教程(第二部)老男孩linux教程 http://edu.51cto.com/course/course_id-1035-page-1.html 2) 跟着老男孩从0开始一步步实战深入学习linux运维(三) http://edu.51cto.com/lesson/id-11909.html linux学习资料持续更新中,布布扣,bubuko.com

Hello World!的各种编程语言程序(持续更新中……)

对于很多学习编程语言新手们,可能接触到的第一个程序就是"Hello World"的输出程序,笔者想在此篇简短的博文中介绍关于各种编程语言的"Hello World"输出程序. 至今,笔者仅仅接触过C++和Python两种编程语言,而且都仅仅是新手,所以此次只能写C++和Python两种语言的"Hello World"输出程序,但此篇博文会随着笔者学习的编程语言种类的增多而不断完善. 1. C++语言 #include<iostream>

阿里笔试题(2015)持续更新中

第一次做阿里笔试题,除了ACM题之外从来没有做过校招网络题呀,完全是裸考,总体感觉吧,对于我来说,感觉时间不够用,不是题不会,感觉时间紧,大脑很混乱,总结这一次的笔试题 废话不多说,直接上题和答案 平均每个人逗留时间为20分钟,那么开场前20分钟一共来了400人,且有20个人逗留时间已经到,但他们不一定出去,注意是平均时间,所有博物馆最少应该容纳500人 双向循环列表,从任何一个元素开始可以遍历全部元素 先和后面的元素相连 s->next=p->next; p->next->pre

Atom使用记录(持续更新中)

部分内容取自:http://www.jianshu.com/p/dd97cbb3c22d,我自己也在使用,持续更新中 Atom安装插件在窗口中File---Setting---install 在里面进行搜索就行. minimap: 为Atom加上一个代码预览地图,就想sublime中右侧的缩略图一样,效果如图. Emmet(和sublime一样的) simplified-chinese-menu:Atom的简体中文语言包,完整汉化,兼容所有已发布的版本Atom. autoclose-html:h

老男孩高端linux运维在线课程视频全套,持续更新中!

老男孩高端linux运维在线课程视频全套,持续更新中 http://edu.51cto.com/course/course_id-5651.html

资源向导之 JOS 计划 #持续更新中# MIT 6.828

JOS 计划 #持续更新中# 童鞋,上网要科学上网,做lab也要科学的做. 之前我一上来就做实验,很多资料都不知道.现在打算重新来过 方法: 0.xv6源码不要用MIT官网的那份,我的主机是Linux/Ubuntu 14.0各种编译error,我都改的想吐.后来直接用github上别人改好的,直接能跑起来没有编译错误的xv6. 1.按照MIT给出的课程安排表,每一次课的相关lecture必须全部过一遍. 2.要求的课堂作业必须完成,很多时候课程要求的任务是很轻松的,只要修改部分代码就行了.这里我

shell 常用文件、字符串、二元整数测试操作符-持续更新中

常用的文件测试操作符-持续更新中 -e--exist 文件存在为真 -f--file 文件存在且为普通文件为真 -d--directory 文件存在且为目录为真 -s--size 文件存在且大小不为零为真 -r--read 文件存在且可读为真 -w--write 文件存在且可写为真 -x--executable 文件存在且可执行为真 -L--link 文件存在且为链接文件则为真 f1 -nt f2--new than f1比f2新则为真 f1 -ot f2--old than f1比f2旧则为真