第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Xamarin Forms Image 控件分配的高度超過(guò)請(qǐng)求的高度

Xamarin Forms Image 控件分配的高度超過(guò)請(qǐng)求的高度

C#
Cats萌萌 2022-12-04 10:34:31
我正在為我的元素設(shè)置一個(gè)顯式HeightRequest的;但是調(diào)試的時(shí)候,實(shí)際好像跳到了. 這是我的 Xaml:16ImageHeight70<Grid Margin="1" Padding="0" ColumnSpacing="0" RowSpacing="0" HeightRequest="17">    <BoxView CornerRadius="3" Color="LightGray"/>    <BoxView Margin="1" CornerRadius="3" BackgroundColor="White"/>    <StackLayout Margin="2,0,2,0" Orientation="Horizontal" HeightRequest="17" Spacing="0">        <Image Source="hooray_icon"               WidthRequest="16"               HeightRequest="16"               Margin="1,0,1,0"               Aspect="Fill"/>        <Label Text="{Binding HoorayCount}"               Margin="1,0,1,0"               VerticalOptions="Center"               VerticalTextAlignment="Center"               HorizontalOptions="Center"               HorizontalTextAlignment="Center"               HeightRequest="16"/>    </StackLayout></Grid>預(yù)期設(shè)計(jì):實(shí)際設(shè)計(jì):hooray_icon是一個(gè) 512x512 PNG 圖像。Xamarin.Forms 版本:3.6.0.293080PS 我知道這是通過(guò)使用和覆蓋以及調(diào)試和方法Image導(dǎo)致問(wèn)題的元素。如果我弄錯(cuò)了,請(qǐng)糾正我。class CustomImage : ImageOnMeasureOnSizeAllocated
查看完整描述

1 回答

?
千巷貓影

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個(gè)贊

回答

HeightRequest不能保證,這只是一個(gè)請(qǐng)求。如果 Xamarin.Forms 能夠滿足請(qǐng)求,它會(huì)執(zhí)行它,但根據(jù)屏幕大小和布局,它可能無(wú)法滿足請(qǐng)求。

解決方案

設(shè)置Grid.ColumnDefinition'sWidthGrid.RowDefinition'sHeight的值。

代碼

<Grid Margin="1" Padding="0" ColumnSpacing="0" RowSpacing="0">

  <Grid.RowDefinitions>

    <RowDefinition Height="17" />

  </Grid.RowDefinitions>

  <Grid.ColumnDefinitions>

    <ColumnDefinition Width="17" />

    <ColumnDefinition Width="17" />

    <ColumnDefinition Width="17" />

  </Grid.ColumnDefinitions>

    <BoxView CornerRadius="3" Color="LightGray" Grid.Row="0" Grid.Column="0"/>

    <BoxView Margin="1" CornerRadius="3" BackgroundColor="White" Grid.Row="0" Grid.Column="1"/>

    <StackLayout Margin="2,0,2,0" Orientation="Horizontal" Spacing="0" Grid.Row="0" Grid.Column="2">

        <Image Source="hooray_icon"

               Margin="1,0,1,0"

               Aspect="Fill"

               HeightRequest="16"/>

        <Label Text="{Binding HoorayCount}"

               Margin="1,0,1,0"

               VerticalOptions="Center"

               VerticalTextAlignment="Center"

               HorizontalOptions="Center"

               HorizontalTextAlignment="Center"

               HeightRequest="16"/>

    </StackLayout>

</Grid>


查看完整回答
反對(duì) 回復(fù) 2022-12-04
  • 1 回答
  • 0 關(guān)注
  • 139 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)