I got an issue while trying to display a gif for my UI.
When the app is launched, the .gif file is correctly loaded (if i change the path, a loading error occure) but the webView is displayed blank.
Android version : marshmallow 6.0 API lvl 23
the "ship_sea.gif" is currently located in Assets Folder, with "Android Asset" in build action.
the axml:
<WebView
android:id="#+id/myWebGIF"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="50dp"
android:layout_marginLeft="50dp" />
the .cs :
WebView webGif = FindViewById<WebView>(Resource.Id.myWebGIF);
webGif.LoadUrl(string.Format("file:///android_asset/ship_sea.gif"));
Why is this not working? It is really simple and I can't figure out what is the problem.
Could it be the device as this post suggests (NVIDIA Shield Tablet K1)?
Ok guys, here is the answer :
Be sure that your canvas is the same size as your gif.
In my case, i had a particular large gif, and the only part rendered in my canvas was the top-left (a blank part).
The default background color for a webView is white, so it resulted in a blank view.
Problem solved : there was no error, just wrong interpretation of the problem.
Related
How can I rotate a text in c# android xamarin? If I use rotate: this happens
I did read some similar question that maybe overriding textview helps, but how can I do this?
The problem is as you can see the in the posted image the width and height stays the same so it's still using the same space(this is visible in visual studio here) however the rotated element occupies less space(layout_rowweight is not relative) and the text getting cut off.
What I want to achieve is to use layout_rowweight(or sg similar) to fill the fullscreen relatively. Do I have to override textview somehow?
Basically what I want is to rotate execute first then every other property relative to the new rotation.
<TextView
android:text="Placeholder 101"
android:textSize="25sp"
android:background="#F44336"
android:layout_columnSpan="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_rowSpan="1"
android:textDirection="?android:attr/windowTransitionBackgroundFadeDuration"
android:id="#+id/textViewx1"
android:rotation="90" />
I have added the Nuget packages for Xamarin.Controls.SignaturePad.Forms into my xamarin forms solution. I call the GetImageStreamAsync(SignatureImageFormat.Jpg);. When I run it with White background and black stroke color it only works on ios. Android displays a black screen. THen when I try to set the background to black and White stroke color, Android displays correctly and ios displays a white block and doesn't display correctly. Does anyone have any solutions to this? Ideally it would be good to have the same background color and stroke color on either platforms. I can get around it by setting the background color and stroke color depending on OS, but that seems a bit hacky. Here's what works with the android in Xamarin Forms when I call var str = await PadView.GetImageStreamAsync(SignatureImageFormat.Jpg);. Setting a "White" Background doesn't show up in Android. It always shows a black square. Is there something I'm missing? I'm trying the source https://github.com/xamarin/SignaturePad Thanks.
<forms:SignaturePadView x:Name="PadView"
HeightRequest="100"
WidthRequest="140"
BackgroundColor="Black"
SignatureLineColor="White"
PromptText="Sign here"
PromptTextColor="Gray"
ClearText="Clear"
ClearTextColor="{StaticResource Accent}"
StrokeColor="White"
StrokeWidth="4" />
see comment - Rebuilt source and hard coded White into android background color when it creates the image of the signature. It suits what I have to do, so may not work if you want another color, or you may have to hard code your own color in the android and ios version. Didn't delve into the SignaturePad code enough to see what was going on.
I Have an problem, and I do not identify what are wrong. I use Notification Visualizer app for preview my Tiles.
I have one XML template, and this work with somes images and for another not work, by example:
My Template XML for tile:
<tile>
<visual branding="nameAndLogo">
<binding template="TileMedium">
<image src="http://vignette2.wikia.nocookie.net/fantendo/images/2/25/Mario_Artwork_-_Super_Mario_3D_World.png/revision/latest?cb=20131025223058.png" placement="peek" hint-overlay="20"/>
<image src="http://s3.amazonaws.com/media.eremedia.com/uploads/2012/08/24111405/stackoverflow-logo-700x467.png" placement="background"/>
</binding>
</visual>
</tile>
The problem are:
Url 1 (Work - Applied on template above) = "http://gcn.net.br/dir-arquivo-imagem/2015/09/20150914133707_34730594.jpg"
Url 2 (not work - If you change url above for this) = "http://vignette2.wikia.nocookie.net/fantendo/images/2/25/Mario_Artwork_-_Super_Mario_3D_World.png/revision/latest?cb=20131025223058.png"
When i put this template on Notification Visualizer app, the preview work perfectly but when I pin the Tile, not work. The problem are the same when I apply this on my application.
Why tile work with some url and anothers not work?
Someone help me?
Thanks
There is a 200KB (and 1024x1024 pixel limit) on images that are shown on tile updates. The image pointed to in your second URL is above this limit, which explains why the update is not being rendered.
I am using the Xamarin Studio. I have a problem when I try to use an ImageButton. The problem is that whatever image I use it doesn't fit with the button. The image is too big or too small. Even if I try to resize the button, the image doesn't stretch to be at the same size with the button.
Couple of questions to start with - which version of Xam.Android are you using (stable, beta, alpha) and can you post the code you're currently using?
This solution may help you in any case : Fit Image in ImageButton in Android
If you need the image to stretch use scaleType attribute with fitXY like so:
try different settings from the visual designer to see the effects
<ImageButton
android:src="#android:drawable/someDrawable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/imageButton1"
android:scaleType="fitXY" />
I'm having weird issues with the LargeImageSource for the Application menu (using Office2007Blue theme)
My image is 48x48 but it appears to be scaling down to 10x10. It's not using SmallImageSource at all.
<r:Ribbon.ApplicationMenu>
<r:RibbonApplicationMenu>
<r:RibbonApplicationMenu.Command>
<r:RibbonCommand
SmallImageSource="images/icon.png"
LargeImageSource="images/icon.png"
ToolTipTitle="Application Menu"
ToolTipDescription="Click here to open files or close the application." />
</r:RibbonApplicationMenu.Command>
<r:RibbonApplicationMenuItem>
<r:RibbonApplicationMenuItem.Command>
<r:RibbonCommand
LabelTitle="_Close"
LabelDescription="Close the Application"
/>
</r:RibbonApplicationMenuItem.Command>
</r:RibbonApplicationMenuItem>
</r:RibbonApplicationMenu>
</r:Ribbon.ApplicationMenu>
Changing the image's printed dimensions fixed it. The button doesn't look at the pixel dimensions.
The WPF Ribbon is full of bugs. This one in particular is because the SmallImageSource Image is hardcoded to 16x16 in the RibbonApplicationMenu's control template. LargeImageSource isn't even used anywhere in the default theme.