Xamarin. Android DesignerXamarin.Android Designer

本文介绍了 Xamarin. Android Designer 的功能。它介绍了设计器的基础知识,演示了如何使用设计器直观地展示小组件并编辑属性。它还说明了如何使用设计器跨各种配置(如主题、语言和设备配置)使用用户界面和资源,以及如何为横向和纵向等替代视图设计。This article describes the features of the Xamarin.Android Designer. It explains designer basics, demonstrating how to use the Designer to lay out widgets visually and edit properties. It also illustrates how to use the Designer to work with user interfaces and resources across various configurations, such as themes, languages, and device configurations, as well as how to design for alternative views such as landscape and portrait.

概述Overview

Xamarin 支持基于 XML 文件的声明性样式的用户界面设计,并支持在代码中创建编程用户界面。Xamarin.Android supports both a declarative style of user interface design based in XML files, as well as programmatic user interface creation in code. 使用声明性方法时,可以使用 Xamarin Android Designer 以视觉方式手动编辑或修改 XML 文件。When using the declarative approach, XML files can be either hand-edited or modified visually by using the Xamarin.Android Designer. 使用设计器可在创建 UI 期间立即做出反馈,加快开发速度,并使 UI 创建过程更不费力。Use of a designer allows immediate feedback during UI creation, speeds up development, and makes the process of UI creation less laborious.

本文将调查 Xamarin. Android Designer 的许多功能。This article surveys the many features of the Xamarin.Android Designer. 它介绍了以下内容:It explains the following:

  1. 使用设计器的基础知识。The basics of using the Designer.
  2. 构成设计器的各个部分。The various parts that make up the Designer.
  3. 如何将 Android 布局加载到设计器中。How to load an Android layout into the Designer.
  4. 如何添加小组件。How to add widgets.
  5. 如何编辑属性。How to edit properties.
  6. 如何使用各种资源和设备配置。How to work with various resources and device configurations.
  7. 如何修改横向和纵向等其他视图的用户界面。How to modify a user interface for alternative views such as landscape and portrait.
  8. 如何处理在使用备用视图时可能出现的冲突。How to handle conflicts that may arise when working with alternative views.
  9. 如何使用材料设计工具构建符合规范标准的应用。How to use Material Design tools to build Material Design-compliant apps.

各节内容Sections

使用 Android DesignerUsing the Android Designer

设计器基础知识Designer Basics

资源限定符和可视化效果选项Resource Qualifiers and Visualization Options

备选布局视图Alternative Layout Views

材料设计功能Material Design Features

总结Summary

本文讨论了 Xamarin. Android Designer 的功能集。This article discussed the feature set of the Xamarin.Android Designer. 它介绍了如何开始设计设计器,并说明了其各个部分。It showed how to get started with the Designer, and explained its various parts. 它介绍了如何使用设计器图面视图加载布局以及如何添加和修改小组件。It described how to load a layout, as well as how to add and modify widgets, by using both the Designer Surface as well as the Source view. 还介绍了如何使用各种资源和设备配置。It also explained how to work with various resources and device configurations. 最后,探讨了如何使用设计器来开发专门为替代视图(如横向和纵向)构建的用户界面,以及如何解决此类视图之间可能出现的冲突。Finally, it examined how to use the Designer to develop user interfaces that are built specifically for alternative views, such as landscape and portrait, as well as how to resolve conflicts that may arise between such views.