android按钮周围阴影,Android 上的按钮填充和阴影

Android 上的按钮填充和阴影Button Padding and Shadows on Android

07/10/2018

本文内容

此 Android 平台特定控制按钮是否 :::no-loc(Xamarin.Forms)::: 使用 Android 按钮的默认填充和阴影值。This Android platform-specific controls whether :::no-loc(Xamarin.Forms)::: buttons use the default padding and shadow values of Android buttons. It's consumed in XAML by setting the Button.UseDefaultPadding and Button.UseDefaultShadow attached properties to boolean values:

xmlns:android="clr-namespace::::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific;assembly=:::no-loc(Xamarin.Forms):::.Core">

...

android:Button.UseDefaultPadding="true"

android:Button.UseDefaultShadow="true" />

此外,还可以使用 Fluent API 从 c # 使用该方法:Alternatively, it can be consumed from C# using the fluent API:

using :::no-loc(Xamarin.Forms):::.PlatformConfiguration;

using :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific;

...

button.On().SetUseDefaultPadding(true).SetUseDefaultShadow(true);

Button.On方法指定此平台特定的仅在 Android 上运行。The Button.On method specifies that this platform-specific will only run on Android. [ Button.SetUseDefaultPadding ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. SetUseDefaultPadding (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。Button}、System.object) # A3 和 [ Button.SetUseDefaultShadow ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. SetUseDefaultShadow (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。Button}、system.string) # A7 方法(位于 :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific 命名空间中)用于控制 :::no-loc(Xamarin.Forms)::: 按钮是否使用 Android 按钮的默认填充和阴影值。The Button.SetUseDefaultPadding and Button.SetUseDefaultShadow methods, in the :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific namespace, are used to control whether :::no-loc(Xamarin.Forms)::: buttons use the default padding and shadow values of Android buttons. 此外,[ Button.UseDefaultPadding ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. UseDefaultPadding (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。Button} ) # A3 和 [ Button.UseDefaultShadow ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. UseDefaultShadow (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。Button} ) # A7 方法可用于返回某个按钮是否分别使用默认填充值和默认阴影值。In addition, the Button.UseDefaultPadding and Button.UseDefaultShadow methods can be used to return whether a button uses the default padding value and default shadow value, respectively.

结果是, :::no-loc(Xamarin.Forms)::: 按钮可以使用 Android 按钮的默认填充和阴影值:The result is that :::no-loc(Xamarin.Forms)::: buttons can use the default padding and shadow values of Android buttons:

21fac6661b5c622a7e78e1dcd050942e.png

请注意,在上面的屏幕截图中,每个 Button 都具有相同的定义,只不过右侧 Button 使用 Android 按钮的默认填充和阴影值。Note that in the screenshot above each Button has identical definitions, except that the right-hand Button uses the default padding and shadow values of Android buttons.

相关链接Related links

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值