There is unwanted space between image & text on Button. I want to reduce it. This is my code
<Button
Padding="4,0,0,0"
FontFamily="{StaticResource mediumFontFamily}"
ImageSource="ic_qr_refresh.png"
WidthRequest="110"
HeightRequest="35"
FontSize="Small"
VerticalOptions="FillAndExpand"
Text="Refres">
</Button>
This is how it is showing
I want to reduce space between refresh icon and Refresh text.
try to use the Padding of 50 or more
<Button
Padding="4,0,50,0"
FontFamily="{StaticResource mediumFontFamily}"
ImageSource="ic_qr_refresh.png"
WidthRequest="110"
HeightRequest="35"
FontSize="Small"
VerticalOptions="FillAndExpand"
Text="Refres">
Related
I am creating a rounded menu with Xamarin Forms as Below.
The accent color is my Grid. Then I translatex and trnaslatey the buttons.
My issue is that the click button is not raised. I have also tried on the gesture recognizer of my stack panel. Same result.
The part of the code is below:
<Grid BackgroundColor="Accent" Margin="0,0,0,10" VerticalOptions="End" HorizontalOptions="Center">
<StackLayout x:Name="cat" TranslationX="-109" TranslationY="-102"
>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="catBtn_Clicked"/>
</StackLayout.GestureRecognizers>
<Button Clicked="catBtn_Clicked" WidthRequest="60"
HeightRequest="60"
FontSize="35"
CornerRadius="30" HorizontalOptions="Center"
BackgroundColor="{StaticResource RedColor}"
TextColor="White"
Text="{ x:Static local:GrialIconsFont.Calendar }"
FontFamily="{ StaticResource IconsFontFamily }">
</Button>
<Label Text="{extensions:Translate Hello}" HorizontalOptions="Center"/>
</StackLayout>
Make sure that your button is placed inside superView's bounds,
If a button is placed outside superView's bounds, the button will not clickable.
You use TranslationX="-109" and TranslationY="-102" will make the button out of the bounds of StackLayout, so it won't response to the click event. You can add backgroundColor to stacklayout to see its bounds.
I would suggest you to add those buttons or labels directly to Grid and use absolute-layout, relative-layout or other layout to fix their positions.
There are also some examples in Github you can refer, such as CircleButtonMenu, Xamarin.Forms-RadialMenu
good day, I'm having a problem with a scroll view, I have a label in a horizontal scroll view, that label concateno amounts, the problem is when the text no longer fit on the screen, the scroll does not move, and I would like if I enter a new quantity in the label, the scroll scrolls so that the last added quantity can be visible, I hope you can help me
This is my XAML:
<ScrollView x:Name="SV" Orientation="Horizontal" HorizontalScrollBarVisibility="Never" HorizontalOptions="FillAndExpand">
<Label Text="{Binding FullSumList}" TextColor="#000000" FontSize="{extensions:ScalableFont 30}" VerticalOptions="EndAndExpand" HorizontalOptions="EndAndExpand" />
</ScrollView>
I searched, not to find a solution
there if I write a quantity, should the scroll go to the left, so that the new quantity is seen
You can use the ScrollToAsync method.
In your xaml
<ScrollView x:Name="SV" Orientation="Horizontal" HorizontalScrollBarVisibility="Never" HorizontalOptions="FillAndExpand">
<Label x:Name="labelTest" Text="{Binding FullSumList}" TextColor="#000000" FontSize="{extensions:ScalableFont 30}" VerticalOptions="EndAndExpand" HorizontalOptions="EndAndExpand" />
</ScrollView>
In the code-behind
SV.ScrollToAsync(labelTest, ScrollToPosition.End, true);
In my application, I have an image control with a scrollbar. so I want to zoom in and zoom out the image on (Plus, Minus) button click.
<ScrollViewer Name="scrollViewerimage"
VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible" Margin="42,10,19,259" Grid.Row="2" ViewChanged="ScrollViewerimage_ViewChanged" SizeChanged="ScrollViewerimage_SizeChanged">
<Image x:Name="DisplayImage" Stretch="None"
Margin="0,0,0,0" Width="647"
HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Height="585" Grid.Row="1" >
</Image>
</ScrollViewer>
Any help would be highly appreciated.
How to overlap a Button with a CircleImage in Xamarin.Forms ?
I have created circle image.
<Grid>
<ci:CircleImage
HeightRequest="120"
WidthRequest="120"
Source="profile.png"
Aspect="AspectFit">
</ci:CircleImage>
<Button Text="Add Photo" CornerRadius="14" Margin="0,0,0,-10" Font="12" HeightRequest="35" BackgroundColor="White" TextColor="Red" HorizontalOptions="Center" VerticalOptions="End"></Button>
</Grid>
I want to create a notification icon and showing all unread message as count, How to achieve this. This tool is best for this.
I'm sharing the one I build.
It's picture with a badge on top of it with Xamaring controls only.
Just fine tune the Height and Width of the "badge" on the Frame and the content on the Label.
Position the X-Axis of the badge with the ConstraintExpression: "Constant=14"
<RelativeLayout>
<Image Source="picture.png" WidthRequest="28" HeightRequest="28" />
<Frame BackgroundColor="#FF0000" OutlineColor="White"
RelativeLayout.HeightConstraint="22"
RelativeLayout.WidthConstraint="22"
CornerRadius="11"
HorizontalOptions="Center"
Padding="0"
IsClippedToBounds="True"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0, Constant=14}"
RelativeLayout.YConstraint="-6">
<StackLayout WidthRequest="22">
<Label Padding="2" Text="+5" RelativeLayout.WidthConstraint="22" TextColor="White" FontSize="12" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" />
</StackLayout>
</Frame>
</RelativeLayout>
Picture of the above code on my app (the "+5" badge):
First, you need to have a BadgeView, to represent the notification counter.
In order to achieve this, you can use the BadgeView NuGet Package
After adding to your solution, you can add in XAML a badge indicator:
<badge:BadgeView Text="{Binding BadgeNumber}" BadgeColor="{Binding BadgeColor}" VerticalOptions="Center" HorizontalOptions="End" />
The next step, is putting all together, so you need to have a Image (your bell), and pack the image with the Badge View. Since you want to overlay both elements, you can use a Grid.
<Grid>
<Image Source="bell.png" HorizontalOptions="Center" VerticalOptions="Center"
<badge:BadgeView Text="{Binding BadgeNumber}" BadgeColor="{Binding BadgeColor}" VerticalOptions="End" HorizontalOptions="Start" />
</Grid>
Here you are setting the image, to be in the center, and the badge to be in the Top Left Corner. After this, you should manipulate the Badge Position with Margins, in order to put the badge in the correct position that you want.