菜鸟教程小白 发表于 2022-12-11 17:53:24

android - 在 xamarin 表单设计方面需要帮助


                                            <p><p>我正在使用具有 android 和 IOS 项目的可移植 xamarin 表单(跨平台)制作应用程序。</p>

<p>我遇到了设计问题。</p>

<p>下面是我的代码。 </p>

<pre><code>&lt;Grid ColumnSpacing=&#34;0&#34; RowSpacing=&#34;0&#34; &gt;

    &lt;Grid.RowDefinitions &gt;
      &lt;RowDefinition Height=&#34;Auto&#34;&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height=&#34;Auto&#34;&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height=&#34;Auto&#34;&gt;&lt;/RowDefinition&gt;
    &lt;/Grid.RowDefinitions&gt;
    &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition Width=&#34;*&#34;&gt;&lt;/ColumnDefinition&gt;
    &lt;/Grid.ColumnDefinitions&gt;

    &lt;StackLayout Grid.Row=&#34;0&#34; Grid.Column=&#34;0&#34; Padding=&#34;20,30,20,0&#34;&gt;
      &lt;StackLayout VerticalOptions=&#34;StartAndExpand&#34; HorizontalOptions=&#34;FillAndExpand&#34; HeightRequest=&#34;30&#34; BackgroundColor=&#34;#6E335E&#34; Padding=&#34;10,0,10,0&#34; &gt;
      &lt;Label Text=&#34;{ Binding CompanyName }&#34; FontSize=&#34;18&#34;HorizontalOptions=&#34;Start&#34; VerticalOptions=&#34;CenterAndExpand&#34;HorizontalTextAlignment=&#34;Center&#34; TextColor=&#34;White&#34; &gt;&lt;/Label&gt;

      &lt;/StackLayout&gt;
    &lt;/StackLayout&gt;

    &lt;StackLayout VerticalOptions=&#34;FillAndExpand&#34; Grid.Row=&#34;1&#34; HeightRequest=&#34;130&#34;HorizontalOptions=&#34;FillAndExpand&#34; Padding=&#34;20,0,20,0&#34;&gt;
      &lt;ImageSource=&#34;{ Binding LogoPath }&#34; VerticalOptions=&#34;FillAndExpand&#34;   HorizontalOptions=&#34;FillAndExpand&#34; Aspect=&#34;AspectFill&#34;&gt;&lt;/Image&gt;

    &lt;/StackLayout&gt;

    &lt;StackLayout Grid.Row=&#34;2&#34; Grid.Column=&#34;0&#34; Padding=&#34;10,0,10,30&#34; VerticalOptions=&#34;StartAndExpand&#34; HorizontalOptions=&#34;FillAndExpand&#34; &gt;
      &lt;ImageSource=&#34;image_bottom.png&#34; VerticalOptions=&#34;FillAndExpand&#34; HorizontalOptions=&#34;FillAndExpand&#34; Aspect=&#34;AspectFill&#34;&gt;&lt;/Image&gt;
    &lt;/StackLayout&gt;

&lt;/Grid&gt;
</code></pre>

<p>下面是描述我想要设计的图片</p>

<p> <a href="/image/pmpHf.png" rel="noreferrer noopener nofollow"><img src="/image/pmpHf.png" alt="enter image description here"/></a> </p>

<p>请帮我设计问题。</p>

<p>提前感谢</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您的 stacklayout 的高度为 130,因此行定义仅扩展到该点。您应该将定义设置为 *,并将网格垂直选项设置为 fillandexpand,以便填充剩余的空间。 </p>

<pre><code>&lt;Grid.RowDefinitions &gt;
          &lt;RowDefinition Height=&#34;Auto&#34;&gt;&lt;/RowDefinition&gt;
          &lt;RowDefinition Height=&#34;*&#34;&gt;&lt;/RowDefinition&gt;
          &lt;RowDefinition Height=&#34;Auto&#34;&gt;&lt;/RowDefinition&gt;
&lt;/Grid.RowDefinitions&gt;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于android - 在 xamarin 表单设计方面需要帮助,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/40146968/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/40146968/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: android - 在 xamarin 表单设计方面需要帮助