博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
xamarin.forms_Xamarin.Forms 4.4助您一臂之力
阅读量:2514 次
发布时间:2019-05-11

本文共 6678 字,大约阅读时间需要 22 分钟。

xamarin.forms

CarouselView control in Xamarin.Forms 4.4.0. Along with this we also have 
CarouselView控件。 除此之外,我们还具有
IndicatorView for displaying the pages or items in the carousel. As well as 
IndicatorView用于显示轮播中的页面或项目。 以及
SwipeView for providing contextual actions to any element in a 
SwipeView用于为
CollectionView. The release theme of getting things moving would not be complete without showcasing the new GIF animation support for images. Let’s begin right there.
CollectionView任何元素提供上下文操作。 如果不展示对图像的新GIF动画支持,那么使事情动起来的发行主题将是不完整的。 让我们从那里开始。

Xamarin.Forms 4.4功能 (Xamarin.Forms 4.4 Features)

GIF animations are a great and simply way to add animation to your app for better user feedback, calling attention to some action or detail. It’s also great for cat GIFs, of course. The Image is all you need along with the new IsAnimationPlaying property to enable and disable playback.

GIF动画是一种将动画添加到您的应用中的绝佳方法,可以更好地吸引用户,引起人们对某些动作或细节的注意。 当然,这对于cat GIF也很棒。 您只需拥有Image以及新的IsAnimationPlaying属性即可启用和禁用播放。

Animations will loop by default. To stop an animation, set IsAnimationPlaying to false.

动画将默认循环播放。 要停止动画,请将IsAnimationPlaying设置为false。

Just like that you have animations! This is ideal for smaller images, and especially those embedded in your application. Looping settings in the GIF image are respected. Make sure you are using fast renderers on Android for the best experience.

就像您有动画一样! 对于较小的图像,特别是嵌入在应用程序中的图像,这是理想的选择。 遵守GIF图像中的循环设置。 确保您在Android上使用快速渲染器以获得最佳体验。

CarouselView和IndicatorView (CarouselView and IndicatorView)

Built upon the same base control as CollectionView, the new CarouselView makes it simple to add rich carousels to your app no matter whether you’re scrolling horizontally or vertically. Just as you get with CollectionView you get:

基于与CollectionView相同的基本控件,新的CarouselView使您可以轻松地向应用程序添加丰富的轮播,无论您是水平滚动还是垂直滚动。 就像使用CollectionView您将获得:

  • ItemsLayout

    ItemsLayout
  • ItemsSource

    ItemsSource
  • ItemTemplate

    ItemTemplate
  • EmptyTemplate

    空模板
    
        
            
h01.jpg
            
h02.jpg
            
h03.jpg
            
h04.jpg
        
    
    
        
            
        
    

You also get some carousel specific properties for controlling things such as the distance the previous and next items should «peek» into view.

您还可以获得一些特定于轮播的属性,用于控制事物,例如,上一个和下一个项目应“窥视”的距离。

Advanced Tip: In the example above you’ll also note that the previous and next items are scaled and offset. You can achieve this today with a behavior and doing the layout modifications on scroll. When we ship 4.5 you’ll instead be able to use visual states to more easily do this.

高级提示:在上面的示例中,您还将注意到上一个和下一个项目是缩放和偏移的。 今天,您可以通过行为并在滚动上进行布局修改来实现此目的。 当我们发货4.5时,您将可以使用视觉状态更轻松地执行此操作。

To add an IndicatorView you position it wherever you like and then associate it to the CarouselView by name:

要添加一个IndicatorView您可以将其放置在IndicatorView位置,然后按名称将其与CarouselView关联:

// implementation here

For more details about all the powerful things you can do with CarouselView and IndicatorView, refer to the .

有关CarouselViewIndicatorView可以执行的所有功能的更多详细信息,请参阅 。

Note: The previously released NuGet  will be archived and no longer released. If you were using this control, you may remove the NuGet and update your code namespace. We worked to keep the API consistent, but you may need to adjust a few things. 

注意:先前发布的NuGet 将被存档,不再发布。 如果使用此控件,则可以删除NuGet并更新代码名称空间。 我们努力保持API的一致性,但是您可能需要调整一些内容。

滑动查看 (SwipeView)

This control is typically found within a list of items for allowing the user to swipe in any direction to reveal context buttons for common actions like edit or delete. In order to use this control, just wrap it around whatever element you wish to add the behavior to, and specific your SwipeItems. By default a SwipeItem takes a title and an icon, plus a command or click handler. If you wish to add something more complex, you can do that via a template.

通常在项目列表中找到此控件,以允许用户向任意方向滑动以显示上下文按钮以执行诸如编辑或删除之类的常见操作。 为了使用此控件,只需将其包装在您希望向其添加行为的任何元素周围,并指定您的SwipeItems。 默认情况下, SwipeItem带有标题和图标,以及命令或单击处理程序。 如果您想添加更复杂的内容,可以通过模板来完成。

        
                
                        
                                
                                        
                                
                        
                
                 
                  // content here        

The above  by our talented team member Javier Suarez Ruiz.

上面的由我们才华横溢的团队成员Javier Suarez Ruiz撰写的。

You can also use platform-specifics to control the swipe transition mode on  and . For more details about SwipeView, refer to the .

您还可以使用特定于平台的功能来控制和上的滑动转换模式。 有关SwipeView更多详细信息,请参阅 。

贡献者 (Contributors)

Even before the  we had a lot of fantastic contributions in the pipeline that are now appearing in Xamarin.Forms 4.4.0.  from 34 of your fellow developers. Highlights include:

甚至在的之前,我们已经在管道中做出了许多惊人的贡献,这些贡献现在已经出现在Xamarin.Forms 4.4.0中。 从您的34个其他开发人员中 。 重点包括:

  • Use named sizes with FontImageSource – @

    在FontImageSource中使用命名的大小– @

  • Scaling animation methods ScaleXTo and ScaleYTo – @

    缩放动画方法ScaleXTo和ScaleYTo – @

  • Letter-spacing – @

    字母间距– @

  • Placeholder text alignment – @

    占位符文本对齐– @

Xamarin.Forms 4.4入门 (Get Started with Xamarin.Forms 4.4 Today)

To get started with Xamarin.Forms 4.4, update or install from your favorite NuGet package manager. The transition from 4.3.0 is smooth. If you are updating from a previous version, take note that Xamarin.Forms and Xamarin.Essentials now depend on Android Support 28.0.0.3. So you will want to update those together along with any other packages you use that might depend on the Android Support libraries.

要开始使用Xamarin.Forms 4.4,请从您喜欢的NuGet软件包管理器更新或安装。 从4.3.0过渡很顺利。 如果您要从以前的版本进行更新,请注意Xamarin.Forms和Xamarin.Essentials现在依赖于Android支持28.0.0.3。 因此,您将希望将其与可能依赖于Android支持库的所有其他软件包一起更新。

Make sure to enable the new preview features using SetFlags if you wish to use them. To do this globally for all platforms in your solution, add the following in your App.xaml.cs:

如果您想使用SetFlags请确保启用它们。 要针对解决方案中的所有平台全局执行此操作,请在App.xaml.cs添加以下内容:

public App(){    InitializeComponent();     Device.SetFlags(new[] {         "CarouselView_Experimental",         "IndicatorView_Experimental",        "SwipeView_Experimental"     } );     MainPage = new AppShell();}

We will be watching GitHub for your feedback on these preview controls between now and our next version, 4.5 when we expect to move them swiftly out of this preview state.

从现在开始到我们的下一个版本4.5,我们将在GitHub上收到您对这些预览控件的反馈,我们希望将它们快速移出此预览状态。

翻译自:

xamarin.forms

转载地址:http://gadwd.baihongyu.com/

你可能感兴趣的文章
mysql串行化防幻读原理_透彻解读mysql的可重复读、幻读及实现原理
查看>>
pcl dll load failed: 找不到指定的模块。_Python-PCL编译问题 终极解决方案
查看>>
python爬数据以字典变量保存_python爬虫第7篇——爬取的数据如何存档
查看>>
hive启动mysql服务器_sqoop安装及初体验(hive配置mysql服务器)
查看>>
mysql修改user_mysql修改用户密码
查看>>
java多态的实现 继承 重载 覆盖_Java基础篇(二、重载、继承、多态、覆盖重写)...
查看>>
java桌面程序下载_Java桌面应用程序的打包
查看>>
idea java项目打包jar_使用Intellij Idea打包java工程为可执行jar包
查看>>
java 导入其他包_java - 如何从默认包导入类
查看>>
嵌入式和java哪个难学_嵌入式和java哪个前景好
查看>>
java即时通讯 开源_im即时通讯开源
查看>>
kettle java交互_通过Java调取Kettle的结果集
查看>>
mysql 导致iis 假死_解决IIS无响应假死状态
查看>>
mysql数据库读取快照隔离_CookBook/1-MySQL数据库读写锁示例详解、事务隔离级别示例详解.md at master · cuiko/CookBook · GitHub...
查看>>
skinme java 路径错误_java 错误 classes路径配置错误
查看>>
python strptime函数转时间数组_python中datetime模块中strftime/strptime函数,时间字符串转化...
查看>>
python tkinter text 清空_销毁标签的python tkinter
查看>>
python安装tensorflow gpu_[tensorflow] tensorflow-cpu/gpu 安装过程
查看>>
java二维数组矩阵_获取从二维数组矩阵的行和列在Java中
查看>>
scala mysql连接池_Scala 操作Redis使用连接池工具类RedisUtil
查看>>