没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
2016,Microsoft Press和Xamarin合作发布了电子书《使用Xamarin.Forms平台开发移动应用:适用于iOS, Android, 和 Windows的跨平台C#编程》,Xamarin.Forms是Xamarin发布的适用于iOS, Android, 和Windows的移动开发平台。 这本书是Xamarin.Forms编程指导的第三版,前两个版本叫做预览版,因为并不全;而第三版共1200页,可谓集Xamarin.Forms之大成。
资源推荐
资源详情
资源评论
CHARLES PETZOLD
Cross-platform C# programming
for iOS, Android, and Windows
Creating
Mobile Apps
with Xamarin.Forms
Celebrating over 30 years!
spine = 1.4063” (per RRDonnelly)
Creating Mobile Apps
with Xamarin.Forms
9781509302970_XamarinCreatingMobileApps_cover_alternate.indd 1 3/24/2016 12:03:49 PM
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2016 Xamarin, Inc.
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any
means without the written permission of the publisher.
ISBN: 978-1-5093-0297-0
Printed and bound in the United States of America.
First Printing
Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to
this book, email Microsoft Press Support at mspinput@microsoft.com. Please tell us what you think of this book at
http://aka.ms/tellpress.
This book is provided “as-is” and expresses the author’s views and opinions. The views, opinions and information
expressed in this book, including URL and other Internet website references, may change without notice.
Some examples depicted herein are provided for illustration only and are fictitious. No real association or connec-
tion is intended or should be inferred.
Microsoft and the trademarks listed at http://www.microsoft.com on the “Trademarks” webpage are trademarks of
the Microsoft group of companies. All other marks are property of their respective owners.
Acquisitions and Project Editor: Devon Musgrave
Editorial production: John Pierce, Flying Squirrel Press
Cover illustration: Serena Zhang
Contents
Foreword ................................................................................................................................................................................................. xv
Introduction.......................................................................................................................................................................................... xvi
Chapter 1 How does Xamarin.Forms fit in?.............................................................................................. 1
Cross-platform mobile development ...................................................................................................................................... 2
The mobile landscape ............................................................................................................................................................... 2
Problem 1: Different user-interface paradigms .............................................................................................................. 2
Problem 2: Different development environments ......................................................................................................... 3
Problem 3: Different programming interfaces................................................................................................................ 3
Problem 4: Different programming languages .............................................................................................................. 3
The C# and .NET solution ............................................................................................................................................................ 4
A single language for all platforms ..................................................................................................................................... 5
Sharing code ................................................................................................................................................................................. 6
Introducing Xamarin.Forms ......................................................................................................................................................... 8
The Xamarin.Forms option ...................................................................................................................................................... 8
XAML support ............................................................................................................................................................................ 13
Platform specificity ................................................................................................................................................................... 14
A cross-platform panacea? ................................................................................................................................................... 15
Your development environment ............................................................................................................................................. 15
Machines and IDEs ................................................................................................................................................................... 16
Devices and emulators ........................................................................................................................................................... 16
Installation ........................................................................................................................................................................................ 17
Creating an iOS app................................................................................................................................................................. 17
Creating an Android app ....................................................................................................................................................... 18
Creating a Windows app ....................................................................................................................................................... 18
All ready?...................................................................................................................................................................................... 19
Contents iv
Chapter 2 Anatomy of an app ................................................................................................................. 20
Say hello ............................................................................................................................................................................................20
Inside the files .................................................................................................................................................................................24
The iOS project ...........................................................................................................................................................................26
The Android project .................................................................................................................................................................27
The Universal Windows Platform project ........................................................................................................................28
Nothing special! .........................................................................................................................................................................28
PCL or SAP? ......................................................................................................................................................................................29
Labels for text ..................................................................................................................................................................................31
Solution 1. Include padding on the page .......................................................................................................................35
Solution 2. Include padding just for iOS (SAP only) ....................................................................................................36
Solution 3. Include padding just for iOS (PCL or SAP) ...............................................................................................37
Solution 4. Center the label within the page .................................................................................................................39
Solution 5. Center the text within the label ....................................................................................................................41
Chapter 3 Deeper into text ...................................................................................................................... 42
Wrapping paragraphs ..................................................................................................................................................................42
Text and background colors ......................................................................................................................................................44
The Color structure .......................................................................................................................................................................46
Changing the application color scheme ...............................................................................................................................50
Font sizes and attributes .............................................................................................................................................................51
Formatted text ................................................................................................................................................................................53
Chapter 4 Scrolling the stack ................................................................................................................... 60
Stacks of views ................................................................................................................................................................................60
Scrolling content ............................................................................................................................................................................64
The Expands option ......................................................................................................................................................................70
Frame and BoxView ......................................................................................................................................................................74
A ScrollView in a StackLayout? .................................................................................................................................................82
Chapter 5 Dealing with sizes .................................................................................................................... 87
Pixels, points, dps, DIPs, and DIUs ...............................................................................................................................................87
Metrical sizes ...................................................................................................................................................................................96
Contents v
Estimated font sizes ...................................................................................................................................................................... 97
Fitting text to available size ....................................................................................................................................................... 99
A fit-to-size clock........................................................................................................................................................................ 103
Accessibility issues ...................................................................................................................................................................... 105
Empirically fitting text ............................................................................................................................................................... 108
Chapter 6 Button clicks ........................................................................................................................... 113
Processing the click ........................................................................................................................................................................ 113
Sharing button clicks ................................................................................................................................................................. 116
Anonymous event handlers ................................................................................................................................................... 119
Distinguishing views with IDs ................................................................................................................................................ 121
Saving transient data ................................................................................................................................................................ 124
Chapter 7 XAML vs. code ........................................................................................................................ 131
Properties and attributes ......................................................................................................................................................... 132
Property-element syntax ......................................................................................................................................................... 136
Adding a XAML page to your project ................................................................................................................................ 140
The XAML compiler ................................................................................................................................................................... 145
Platform specificity in the XAML file ................................................................................................................................... 146
The content property attribute ............................................................................................................................................. 150
Formatted text ............................................................................................................................................................................. 152
Chapter 8 Code and XAML in harmony ................................................................................................ 156
Passing arguments ..................................................................................................................................................................... 156
Constructors with arguments............................................................................................................................................ 156
Can I call methods from XAML? ...................................................................................................................................... 159
The x:Name attribute ................................................................................................................................................................ 161
Custom XAML-based views .................................................................................................................................................... 167
Events and handlers .................................................................................................................................................................. 172
Tap gestures ................................................................................................................................................................................. 175
Chapter 9 Platform-specific API calls .................................................................................................... 182
Preprocessing in the Shared Asset Project ....................................................................................................................... 182
Parallel classes and the Shared Asset Project .................................................................................................................. 185
剩余1186页未读,继续阅读
duanjn
- 粉丝: 1
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- STM32开发 IIR带阻滤波器 STM32实现IIR无限冲击响应带阻滤波器设计,巴特沃斯滤波器,代码工整,自编代码,注释详细,赠送巴特沃斯和切比雪夫IIR带阻滤波器MATLAB程序
- 四轴抓取视觉旋转标定源代码,学习机器视觉和运动控制的最佳例子,基于VS2015 C++ 实现,仿雅马哈四轴机械手抓取程序,实现把两个任意摆放的物料通过视觉算法和运动控制指令定位摆放到指定的位置并拼接起
- COOFDM的Matlab仿真程序,包括文档代码解释和理论解释
- 伺服驱动器,你还在为伺服驱动器 FPGA架构苦恼吗,本方案FPGA代码实现电流环 速度环 位置环 SVPWM 坐标变 测速 分频 滤波器等,程序方便移植不同的平台,具有很高的研究价值
- omron欧姆龙CJ CP程序 欧姆龙CJ2M-CPU35,主机架搭载两套从机架,ID263.OD263等输入输出IO模块 全自动电池注液封装机,NC413四轴模块轴控制,SCU31无协议读写欧姆龙E
- 基于PI控制器的单相逆变器闭环控制模型,采用电压电流双环控制 波形输出良好,输出跟随给定220V交流输出 运行环境为matlab simulink plecs等
- PLC案例 污水处理系统 - 污水处理项目 某大厂技术给某国企做的污水处理项目,程序规范,图纸清晰,具有很好的参考价值 PLC: 西门子s7 200smart 系统涉及好氧发酵、厌氧发酵、冷热水P
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页