显示hello
The modern user interface is constructed from visual objects of various sorts. Depending on the operating system, these visual objects might go by different names—controls, elements, views, widgets but they are all devoted to the jobs of presentation or interaction or both. In Xamarin.Forms, the objects that appear on the screen are collectively called visual elements. They come in three main categories: page layout view These are not abstract concepts! The Xamarin.Forms application programming interface (API) defines classes named VisualElement, Page, Layout, and View. These classes and their descendants form the backbone of the Xamarin.Forms user interface. VisualElement is an exceptionally important class in Xamarin.Forms. A VisualElement object is anything that occupies space on the screen. A Xamarin.Forms application consists of one or more pages. A page usually occupies all (or at least a large area) of the screen. Some applications consist of only a single page, while others allow navigating between multiple pages. In many of the early chapters in this book, you’ll see just one type of page, called a ContentPage. On each page, the visual elements are organized in a parent-child hierarchy. The child of a ContentPage is generally a layout of some sort to organize the visuals. Some layouts have a single child, but many layouts have multiple children that the layout arranges within itself. These children can be other layouts or views. Different types of layouts arrange children in a stack, in a two-dimensional grid, or in a more freeform manner. In this chapter, however, our pages will contain just a single child. The term view in Xamarin.Forms denotes familiar types of presentation and interactive objects: text, bitmaps, buttons, text-entry fields, sliders, switches, progress bars, date and time pickers, and others of your own devising. These are often called controls or widgets in other programming environments. This book refers to them as views or elements. In this chapter, you’ll encounter the Label view for displaying text.
原文
用户界面是由各种各样的可视化对象构成,由于操作系统不同,可视化对象通常会包含元素、视图和插件,但是他们的目的都是用于展示和交互。
在Xamarin.Forms中,在屏幕上显示出来的对象统称为可视化元素,它们有三大类:
- page(页面)
- layout(布局)
- view(视图)
它们并不是抽象的概念,在Xamarin.Forms的API中定义了这几个类:VisualElement, Page, Layout和View。这些类以及它们的子类是Xamarin.Forms用户界面的基础。VisualElement在Xamarin.Forms中是一个非常重要的类,VisualElement对象可在屏幕上开辟一个区域。
一个Xamarin.Forms通常包含一个或多个页面,一个Page通常会占满一个屏幕的尺寸。有些应用只包含一个Page,有多个Page的应用需要在不同Page之间提供导航功能。在这本书的前几章,都使用的是一种类型的Page,叫做ContentPage。
在每个Page中,可视化元素被组织在一个父节点-子节点的结构中(控件树)。ContentPage的子节点通常是一类组织可视化元素的布局元素。一些布局元素只有一个子节点,而大多数布局元素可以包含多个子节点,甚至子节点就是一个布局元素。不同布局元素在安排子节点的方式上个不相同,可以是栈,可以是二维表格,或者是更自由的方式。然而,在这个章节,我们的Page页只包含一个子节点。
在Xamarin.Forms中的View元素指的是一类用于展示和交互的对象:text(文字), bitmaps(图像), buttons(按钮), text-entry fields(文本输入), sliders(滑块), switches(开关), progress bars(进度条), date and time pickers(日期和时间选择)和自定义。在其他的开发环境中,这些内容通常被叫做控件或者插件。在这本书中称它们为视图或者元素,这一章节,你会遇到Label视图,来显示一段文本。
Using either Microsoft Visual Studio or Xamarin Studio, let’s create a new Xamarin.Forms application by using a standard template. This process creates a solution that contains up to six projects: five platform projects—for iOS, Android, the Universal Windows Platform (UWP), Windows 8.1, and Windows Phone 8.1—and a common project for the greater part of your application code. In Visual Studio, select the menu option File > New > Project. At the left of the New Project dialog, select Visual C# and then Cross-Platform. In the center part of the dialog you’ll see several available solution templates, including three for Xamarin.Forms: Blank App (Xamarin.Forms Portable) Blank App (Xamarin.Forms Shared) Class Library (Xamarin.Forms) Now what? We definitely want to create a Blank App solution, but what kind? Xamarin Studio presents a similar dilemma but in a different way. To create a new Xamarin.Forms solution in Xamarin Studio, select File > New > Solution from the menu, and at the left of the New Project dialog, under Multiplatform select App, pick Forms App, and press the Next button. Toward the bottom of the next screen are a pair of radio buttons labeled Shared Code. These buttons allow you to choose one of the following options: Use Portable Class Library Use Shared Library The term “Portable” in this context refers to a Portable Class Library (PCL). All the common application code becomes a dynamic-link library (DLL) that is referenced by all the individual platform projects. The term “Shared” in this context means a Shared Asset Project (SAP) containing loose code files (and perhaps other files) that are shared among the platform projects, essentially becoming part of each platform project.
原文
不管你使用的是Xamarin Studio还是Visual Studio,我们通过使用标准模板来创建一个Xamarin.Forms应用程序。这个过程中,我们会创建6个项目:5个平台项目(iOS, Android,UWP, Windows 8.1, Windows Phone 8.1)和一个公共项目(应用程序代码的大部分都在这个项目中)。
在Visual Studio中选择菜单:文件>新建>项目。然后在新建项目对话框的左侧选择:Visual C#>Cross-Platform。在对话框中间部分,可以看到这几个可以使用的解决方案模板,有3个是针对Xamarin.Forms的。
- Blank App (Xamarin.Forms Portable) :可移植的Xamarin.Forms解决方案
- Blank App (Xamarin.Forms Shared):可共享的Xamarin.Forms解决方案
- Class Library (Xamarin.Forms):Xamarin.Forms类库项目
如果我们现在要创建一个空白解决方案,要如何选择呢?
For now, pick the first one: Blank App (Xamarin.Forms Portable) in Visual Studio or Use Portable Class Library in Xamarin Studio. Give the project a name—for example, Hello—and select a disk loca-tion for it in that dialog (in Visual Studio) or in the dialog that appears after pressing the Next button again in Xamarin Studio. If you’re running Visual Studio, six projects are created: one common project (the PCL project) and five application projects. For a solution named Hello, these are: A Portable Class Library project named Hello that is referenced by all five application projects; An application project for Android, named Hello.Droid; An application project for iOS, named Hello.iOS; An application project for the Universal Windows Platform of Windows 10 and Windows Mobile 10, named Hello.UWP; An application project for Windows 8.1, named Hello.Windows; and An application project for Windows Phone 8.1, named Hello.WinPhone. If you’re running Xamarin Studio on the Mac, the Windows and Windows Phone projects are not created.
原文
首先在Visual Studio的创建项目对话框中选择:空白应用(可移植Xamarin.Forms),取一个项目名称Hello,然后选择项目位置,然后确定。
解决方案创建结束后,可以看到一共创建了6个项目,一个公共项目(PLC)和5个应用程序项目,如果是使用Xamarin Studio在Mac上创建解决方案,不会包括最后两个项目:
- 可移植的类库项目,名称为Hello,被其他几个项目引用。
- 一个安卓应用程序项目,Hello.Droid
- 一个iOS应用程序项目,Hello.iOS
- 一个UWP应用程序项目,Hello.UWP
- 一个Windows 8.1应用程序项目,Hello.Windows
- 一个Windows Phone 8.1应用程序项目,Hello.WinPhone
移除iOS项目(目前先不研究这个),然后编译各个项目,发现Droid项目编译出现下面错误:
根据错误中给出的地址下载文件android_m2repository,然后将文件名重新命名为96659D653BDE0FAEDB818170891F2BB0.zip,然后到错误提示中的目录C:\Users\freesaber\AppData\Local\Xamarin\zips中替换目录中的文件。然后再次生成,这个时候,错误就只剩下3个。
这个时候,我们要删除C:\Users\freesaber\AppData\Local\Xamarin目录下面的v4目录,再重新生成解决方案即可:
When you create a new Xamarin.Forms solution, the Xamarin.Forms libraries (and various support libraries) are automatically downloaded from the NuGet package manager. Visual Studio and Xamarin Studio store these libraries in a directory named packages in the solution directory. However, the par-ticular version of the Xamarin.Forms library that is downloaded is specified within the solution tem-plate, and a newer version might be available. In Visual Studio, in the Solution Explorer at the far right of the screen, right-click the solution name and select Manage NuGet Packages for Solution. The dialog that appears contains selectable items at the upper left that let you see what NuGet packages are installed in the solution and let you install others. You can also select the Update item to update the Xamarin.Forms library. In Xamarin.Studio, you can select the tool icon to the right of the solution name in the Solution list and select Update NuGet Packages. Before continuing, check to be sure that the project configurations are okay. In Visual Studio, select the Build > Configuration Manager menu item. In the Configuration Manager dialog, you’ll see the PCL project and the five application projects. Make sure the Build box is checked for all the projects and the Deploy box is checked for all the application projects (unless the box is grayed out). Take note of the Platform column: If the Hello project is listed, it should be flagged as Any CPU. The Hello.Droid project should also be flagged as Any CPU. (For those two project types, Any CPU is the only option.) For the Hello.iOS project, choose either iPhone or iPhoneSimulator depending on how you’ll be testing the program.
原文
当你创建一个新的Xamarin.Forms解决方案的时候,项目所需的各种类库会自动的NuGet包管理器进行下载。在Visual Studio或者Xamarin Studio中,这些库文件会存放在一个解决方案目录下的packages的文件夹中。可以自己通过报管理器获取一个最新的更新。在VisualStudio的解决方案资源管理器的右侧,右击解决方案,选择NuGet包管理器,通过弹出的选项卡,你可以搜索安装其他的库,或者对现有库进行更新。
For the Hello.UWP project, the project configuration must be x86 for deploying to the Windows desktop or an on-screen emulator, and ARM for deploying to a phone. For the Hello.WinPhone project, you can select x86 if you’ll be using an on-screen emulator, ARM if you’ll be deploying to a real phone, or Any CPU for deploying to either. Regardless of your choice, Visual Studio generates the same code. If a project doesn’t seem to be compiling or deploying in Visual Studio, recheck the settings in the Configuration Manager dialog. Sometimes a different configuration becomes active and might not include the PCL project. In Xamarin Studio on the Mac, you can switch between deploying to the iPhone and iPhone simulator through the Project > Active Configuration menu item. In Visual Studio, you’ll probably want to display the iOS and Android toolbars. These toolbars let you choose among emulators and devices and allow you to manage the emulators. From the main menu, make sure the View > Toolbars > iOS and View > Toolbars > Android items are checked. In Visual Studio, you’ll probably want to display the iOS and Android toolbars. These toolbars let you choose among emulators and devices and allow you to manage the emulators. From the main menu, make sure the View > Toolbars > iOS and View > Toolbars > Android items are checked. In the Solution Explorer of Visual Studio, right-click any of the five application projects and select the Set As StartUp Project item from the menu. You can then select to deploy to either an emulator or a real device. To build and run the program, select the menu item Debug > Start Debugging. In the Solution list in Xamarin Studio, click the little tool icon that appears to the right of a selected project and select Set As Startup Project from the menu. You can then pick Run > Start Debugging from the main menu. If all goes well, the skeleton application created by the template will run and you’ll see a short message:
原文
As you can see, these platforms have different color schemes. The iOS and Windows 10 Mobile screens display dark text on a light background, while the Android device displays light text on a black background. By default, the Windows 8.1 and Windows Phone 8.1 platforms are like Android in displaying light text on a black background. By default, all the platforms are enabled for orientation changes. Turn the phone sideways, and you’ll see the text adjust to the new center. The app is not only run on the device or emulator but deployed. It appears with the other apps on the phone or emulator and can be run from there. If you don’t like the application icon or how the app name displays, you can change that in the individual platform projects.
原文
显示hello的更多相关文章
- win10 环境 gitbash 显示中文乱码问题处理
gitbash 是 windows 环境下非常好用的命令行终端,可以模拟一下linux下的命令如ls / mkdir 等等,如果使用过程中遇到中文显示不完整或乱码的情况,多半是因为编码问题导致的,修改 ...
- 关于textview显示特殊符号居中的问题
话说这是2017年的第一篇博客,也是一篇技术博客.先从简单的一篇解决问题开始吧,千里之行,始于足下! ------------------------------------------------- ...
- IE的F12开发人员工具不显示问题
按下F12之后,开发人员工具在桌面上看不到,但是任务栏里有显示.将鼠标放在任务栏的开发人员工具上,出现一片透明的区域,选中之后却出不来.将鼠标移动到开发人员工具的缩略图上,右键-最大化,工具就全屏出现 ...
- input[tyle="file"]样式修改及上传文件名显示
默认的上传样式我们总觉得不太好看,根据需求总想改成和上下结构统一的风格…… 实现方法和思路: 1.在input元素外加a超链接标签 2.给a标签设置按钮样式 3.设置input[type='file' ...
- css实现单行,多行文本溢出显示省略号……
1.单行文本溢出显示省略号我们可以直接用text-overflow: ellipsis 实现方法: <style> .div_text{width: 300px; padding:10px ...
- MVC Core 网站开发(Ninesky) 2.1、栏目的前台显示(补充)
在2.1.栏目的前台显示中因右键没有添加视图把微软给鄙视了一下,后来有仔细研究了一下发现应该鄙视自己,其实这个功能是有的,是自己没搞清楚乱吐糟. 其实只要在NuGet中安装两个包(Microsoft. ...
- MVC Core 网站开发(Ninesky) 2.1、栏目的前台显示
上次创建了栏目模型,这次主要做栏目的前台显示.涉及到数据存储层.业务逻辑层和Web层.用到了迁移,更新数据库和注入的一些内容. 一.添加数据存储层 1.添加Ninesky.DataLibrary(与上 ...
- 让kindeditor显示高亮代码
kindeditor4.x代码高亮功能默认使用的是prettify插件,prettify是Google提供的一款源代码语法高亮着色器,它提供一种简单的形式来着色HTML页面上的程序代码,实现方式如下: ...
- ASP.NET Core应用针对静态文件请求的处理[5]: DefaultFilesMiddleware中间件如何显示默认页面
DefaultFilesMiddleware中间件的目的在于将目标目录下的默认文件作为响应内容.我们知道,如果直接请求的就是这个默认文件,那么前面介绍的StaticFileMiddleware中间件会 ...
- Nested Loops join时显示no join predicate原因分析以及解决办法
本文出处:http://www.cnblogs.com/wy123/p/6238844.html 最近遇到一个存储过程在某些特殊的情况下,效率极其低效, 至于底下到什么程度我现在都没有一个确切的数据, ...
随机推荐
- 使用ueditor中的setContent() 时经常报innerHtml错误(笔记)
1)今天遇到个问题,使用ueditor中的setContent() 时经常报innerHtml错误:网上找了下解决方案:发现这个可以用: 不能创建editor之后马上使用ueditor.setCont ...
- 算法课堂笔记14—NP-COMPLETENESS
今天的算法课接着上一节,说的是NP问题. 1.关于什么是P和NP问题 所谓P问题是指所有能在多项式复杂度解决的问题,比如排序算法,n*n复杂度解决问题.而对于有些问题,目前可能没有多项式复杂度的解决方 ...
- [转]JAVA虚拟机的生命周期
JAVA虚拟机体系结构 JAVA虚拟机的生命周期 一个运行时的Java虚拟机实例的天职是:负责运行一个java程序.当启动一个Java程序时,一个虚拟机实例也就诞生了.当该程序关闭退出,这个虚拟机实例 ...
- PLSQL开发笔记和小结(转载)
***************************************** PLSQL基本结构 ***************************************** 基本数据 ...
- iOS开发数据库篇—FMDB数据库队列
iOS开发数据库篇—FMDB数据库队列 一.代码示例 1.需要先导入FMDB框架和头文件,由于该框架依赖于libsqlite库,所以还应该导入该库. 2.代码如下: // // YYViewContr ...
- Asp.net MVC 视图(二)
Razor视图引擎 使用C#语法的Razor视图文件扩展名为.cshtml:使用Visual Basic语法的Razor视图文件扩展名为.vbhtml.文件扩展名指出了Razor语法分析器的编码语言的 ...
- Qt之WebKit学习之绘图
void Serial::on_pushButton_clicked() { //scroll(4,0); flag_btn = true; // this->update(); //绘图绘在窗 ...
- candence 知识积累4
一.PCB布局约束: 1.尺寸规划:PCB大小要合适,PCB太大印制线路长,阻抗增加.太小散热不好,易受干扰. 2.PCB尺寸确定后要确定特殊器件的位置. 3.尽可能缩短高频元器件之间的连线,设法减少 ...
- For-Each循环
For-Each循环也叫增强型的for循环,或者叫foreach循环. For-Each循环是JDK5.0的新特性(其他新特性比如泛型.自动装箱等). For-Each循环的加入简化了集合的遍历. 语 ...
- Android_Layout (一)
layout (布局) --->Android 有五大布局,分别是: LinearLayout : 线性布局,子组件按照垂直或者水平方向来布局. RelativeLayout :相对布局,按照 ...