【问题标题】:Change Constant value of RelativeLayout更改 RelativeLayout 的常量值
【发布时间】:2019-02-04 05:26:25
【问题描述】:

我在RelativeLayout 中有一个TableView

<some code>
<RelativeLayout x:Name="relativeLayout">
<some code >

<TableView  x:Name="tableView" 
RelativeLayout.WidthConstraint="{ConstraintExpression 
Type=RelativeToParent, Property=Width, Factor=1, Constant=0}"

RelativeLayout.YConstraint="{ConstraintExpression 
Type=RelativeToView, ElementName=banner, Property=Height, Factor=1,Constant=120}"

RelativeLayout.HeightConstraint="{ConstraintExpression 
Type=RelativeToParent,Property=Height, Factor=1, Constant=210}">

<some code>

我需要在 210(纵向设备方向)和 500(横向设备方向)之间切换 TableView HeightConstraint 的常量值。

谢谢

【问题讨论】:

    标签: xamarin.forms


    【解决方案1】:

    我在我的应用程序中使用“DynamicResource”做几乎相同的事情。 您可以在 XAML 中定义它们,并在运行时更改 C# 页面代码隐藏文件中的值。

    但现在似乎有更好的解决方案,你看看: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual-state-manager

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多