Xamarin表单:是否可以在Android中添加披露指标?

Xamarin表单:是否可以在Android中添加披露指标?,第1张

概述我有一个TextCell,它在我的Xamarin Forms应用程序的iOS端添加了一个披露指示器: <TextCell Text="Japanese" StyleId="disclosure"/> 我也想为android方面做同样的事情,但我似乎无法找到任何自定义渲染器来做这样的事情. 有没有人能够做到这一点?如果有人能指出我那个方向,我真的很感激. 根据 design guidelines,建

我有一个TextCell,它在我的Xamarin Forms应用程序的iOS端添加了一个披露指示器:

<TextCell Text="Japanese" StyleID="disclosure"/>

我也想为androID方面做同样的事情,但我似乎无法找到任何自定义渲染器来做这样的事情.

有没有人能够做到这一点?如果有人能指出我那个方向,我真的很感激.

解决方法 根据 design guidelines,建议不要在AndroID中的订单项上使用右指向的插入符号(披露指示符).

Don’t use right-pointing carets on line items

A common pattern on other platforms is the display of right-pointing carets on line items that allow the user to drill deeper into additional content.

AndroID does not use such indicators on drill-down line items. AvoID them to stay consistent with the platform and in order to not have the user guess as to what the meaning of those carets may be.

编辑1:

但是,如果您仍想添加指标,则可以使用图像.

Download the icon并添加为drawable到androID项目.并注册渲染器如下:

[assembly: ExportRenderer(typeof(TextCell),typeof(StandardTextCellRenderer))]namespace Appnamespace.DroID{    public class StandardTextCellRenderer : TextCellRenderer    {        protected overrIDe AndroID.VIEws.VIEw GetCellCore(Cell item,AndroID.VIEws.VIEw convertVIEw,AndroID.VIEws.VIEwGroup parent,AndroID.Content.Context context)        {            var cell = base.GetCellCore(item,convertVIEw,parent,context);            switch (item.StyleID)            {                case "disclosure":                    var bmp = BitmapFactory.DecodeResource(cell.Resources,Resource.Drawable.ic_chevron_right);                    var bitmapDrawable = new BitmapDrawable(cell.Resources,Bitmap.CreateScaledBitmap(bmp,50,true));                    bitmapDrawable.Gravity = GravityFlags.Right | GravityFlags.CenterVertical;                    cell.SetBackground(bitmapDrawable);                    break;            }            return cell;        }    }}
总结

以上是内存溢出为你收集整理的Xamarin表单:是否可以在Android中添加披露指标?全部内容,希望文章能够帮你解决Xamarin表单:是否可以在Android中添加披露指标?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1046634.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存