が、私はBootstrap input group addon alignment problems合わせる画像は、次のXamarinフォームコードで
で説明したように、ブートストラップ入力グループのような外観を作成するためにエントリを持つ画像を揃えるしようとしていますフォームしかし、それは次のような欠点があります。
- 画像が指定された以上の幅と高さをとりHeightRequestとWidthRequest
- 画像およびエントリ
これを修正するには? (下手な英語のため申し訳ありませんが)XAML
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyHomeScreen2;assembly=MyHomeScreen2"
x:Class="MyHomeScreen2.InputFormTest"
NavigationPage.HasNavigationBar="False">
<ContentPage.Content>
<Grid x:Name="inputGrid" Grid.Row="1" ColumnSpacing="0" RowSpacing="0" Padding="0" BackgroundColor="#606060">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label x:Name="lblReading" TextColor="White" Text="READING" Grid.Row="0" Margin="15"></Label>
<StackLayout Grid.Row="1" Orientation="Horizontal">
<Image Source="homea.png" Aspect="AspectFit"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
HeightRequest="10" WidthRequest="20"
BackgroundColor="Silver" ></Image>
<Entry x:Name="myEntry" TextColor="Black" Text="1" Keyboard="Numeric" BackgroundColor="White"
Opacity="0.9" HeightRequest="20">
</Entry>
</StackLayout>
</Grid>
</ContentPage.Content>
</ContentPage>
あなたがすることができません "FillAndExpand" の画像の水平方向と垂直方向のオプション。それを "CenterAndExpand"で上書きし、 "FillAndExpand"レイアウトオプションをEntryビューに配置します。 –
私はそれを試していない。しかし、私は問題がそこにあると確信しています。私はそれを働かせることができるかどうか私に見てみましょう、私はあなたに言うでしょう。 (申し訳ありませんが、貧弱な英語) –
1水平、垂直方向のオプションをcenter、start、またはendに変更し、StacklayoutにSpacing = "0"を設定します – Nick