Xamarin.Forms:用户界面在UWP中正常工作,但在Android部件上无法正常工作

时间:2016-06-28 09:56:40

标签: xaml xamarin xamarin.forms uwp uwp-xaml

大家好日子。我目前正在开发一个简单的程序,使用户能够对员工进行CRUD记录。

我能够从ASP.NET Web应用程序中检索创建的数据,并将其显示在程序的UWP部分。但是,每当我在Android上运行它时,它都无法正常工作。含义,某些菜单和按钮未显示。

我在Xamarin.Forms Portable中编写了所有这些代码。

这是我的菜单页面的代码,应该在两个平台上正确显示。如果您想查看更多代码,请告诉我们。非常感谢。

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="XamarinFormsDemo.Views.MenuPage"
         BackgroundImage="bg3.jpg">


  <StackLayout>
    <StackLayout Orientation="Vertical"
             Padding="30"
             HeightRequest="30"
             BackgroundColor="#24e97d">
      <Image Source="ebmspersonnellogo1.png"
         HeightRequest="40"/>
    </StackLayout>


    <StackLayout Orientation="Vertical"
             VerticalOptions="Center"
      Padding="45,60,45,60">


      <Image x:Name="sales"
              Source="salesicon.png">

              <Image.GestureRecognizers>
                <TapGestureRecognizer

                        Tapped="SalesTapGestureRecognizer_OnTapped"
                        NumberOfTapsRequired="1" />
              </Image.GestureRecognizers>
        </Image>

      <Image x:Name="personnel"
        Source="personnelicon.png">

        <Image.GestureRecognizers>
          <TapGestureRecognizer

              Tapped="PersonnelTapGestureRecognizer_OnTapped"
              NumberOfTapsRequired="1" />
        </Image.GestureRecognizers>
      </Image>



  <Image x:Name="crm"
    Source="crmicon.png">

    <Image.GestureRecognizers>
      <TapGestureRecognizer

              Tapped="CRMTapGestureRecognizer_OnTapped"
              NumberOfTapsRequired="1" />
    </Image.GestureRecognizers>
  </Image>



  <Image x:Name="asset"
    Source="asseticon.png">
    <Image.GestureRecognizers>

      <TapGestureRecognizer

              Tapped="AssetTapGestureRecognizer_OnTapped"
              NumberOfTapsRequired="1" />
    </Image.GestureRecognizers>
  </Image>

  <Image x:Name="receivables"
    Source="receivables.png">

    <Image.GestureRecognizers>
      <TapGestureRecognizer

              Tapped="ReceivablesTapGestureRecognizer_OnTapped"
              NumberOfTapsRequired="1" />
    </Image.GestureRecognizers>
  </Image>






  <Image x:Name="prapprovals"
    Source="prapprovals.png">

    <Image.GestureRecognizers>
      <TapGestureRecognizer

              Tapped="ApprovalsTapGestureRecognizer_OnTapped"
              NumberOfTapsRequired="1" />
        </Image.GestureRecognizers>
      </Image>


    </StackLayout>


    <StackLayout Orientation="Vertical"
             Padding="30,10,30,10"
             HeightRequest="20"
             BackgroundColor="#24e97d"
             VerticalOptions="Center"
             Opacity="0.5">
      <Label Text="© Copyright 2015   smesoft.com.ph   All Rights Reserved " 
         HorizontalTextAlignment="Center"
         VerticalOptions="Center" 
         HorizontalOptions="Center" />
    </StackLayout>



  </StackLayout>
</ContentPage>

以下是1.) UWP 和2.) Android的屏幕截图。

UWP

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用网格而不是StackLayout。这在当前情况下最适合。

例如: -

var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
$('.show-more').on('click', function () {
   $.scrollTo($('#scrollto_shortcut'), {
       duration: 0,
       offset: !isMobile ? -60 : 0
   });
});