My Xamarin app has a grid layout that contains a lot of images & image buttons. All images have property Aspect="Fill", the problem is when I open the app, the app took a few seconds to resize the images before it properly fill the grid, it looks bad. So to hide it, I put a full-screen image on top of all the images, the idea is to hide the ugly resizing until all the images done resizing.
I've tried wait for x seconds like await System.Threading.Tasks.Task.Delay(1000); but it isn't good for many reasons: e.g if the init time is longer than Task.Delay(1000) then it doesn't work at all.
So Is there any way I can check if Xamarin's UI has done initialize?
Related
I want to create List View. In this List View, I will have following fields.
StackPanel
1- Image with 300 x 400 size
2- Text-Label Controls
1 Screen will hardly cover 1 and Half ViewCell.
Images will have ImageURL. I want to load image smoothly. I also want to make smooth scroll up/down with image appearing.
Can anybody please suggest me which control I should use?
If List View, which CacheStrategy I should use?
Note: For one of such functionality, I had used List View with default CacheStrategy. In that, I just faced 1 major problem of image appearing. When page initialize first time, it show image properly. But as soon as I scroll down or scroll up, image disappear or misplace. In that case, I had suffered a lot and removed image finally.
Please suggest appropriate way for above functionality.
Thank you.
For the listview, you should definitely use RecycleElement as the CachingStrategy. See here https://developer.xamarin.com/api/type/Xamarin.Forms.ListViewCachingStrategy/#Remarks
And because the images are URLs, you can use FFImageLoading. It will fade-in the image after it is downloaded (as opposed to appearing instantly after downloaded), and you can even specify a placeholder image to use while the image is being downloaded.
I can see that most apps use Rounded Texture Button for Toolbar commands on macOS. However I can't make those buttons look fully native if I use a custom image (vector or bitmap). The problem is that if the window is inactive, image is still painted the same and not semi-transparent. This works fine if I use the system provided images, so my guess is that it has something to do with the image definition, but I have tried various things (like using Assets or Resources, using vector and bitmap images) and still no success. As said I guess it is something simple, but hard enough that I can't find it, can anyone help?
You need to set the image as template image. Only then AppKit is able to render the image correctly in every circumstance.
I develop a image browser to show image series with QSlider. I connncet valueChanged(int) of QSlider to a self-defined function:
QObject::connect(ui.imgIndexSlider, SIGNAL(valueChanged(int)), this,SLOT(onimgIndexSliderValueChanged(int)));
when I drag the slider, the image that QLabel shows will changed by the QSlider value.It works.But there is a problem that if you drag fast,the Application will not run acceptably.
Could you tell me how to slove this problem.
Thank you very much.
It is not clear much from your question, but I am assuming that you are showing images like a slideshow using the slider. When you slide it fast your application is getting choked i.e. freezes?
Qt is rendering the image in your GUI thread.
If the images are all high resolution then it will take much more time in rendering each image.
When you slide faster than Qt can render a single image you will experience problems.
So here is what I would ideally do if I were in your place:
Implement a custom algorithm which will read the image file and
create a preview image of much smaller size. Since you are only
generating a pixmap in memory, you can do this by multi threading.
You can do this when your application is launched.
Show all the preview's as scrollable tiles on left pane similar to
Powerpoint. You can reduce some coding here by letting Qt render
these preview's by using QLabel.
Have a central widget which occupies the major chunk of the window
which will render the images using your custom algorithm. Your
algorithm will be such that it will read the actual image if the
slider is not running. If slider is running fast enough then you simply need to
scale your preview images and display in the widget.
Feel free to ask questions if you find anything difficult to understand. :)
A simple question. I have already finished my app with full functionality and I now need to add background images to make it look nicer. However, if I simply add on top of each view an image view, the image appears in the foreground, covering the buttons/textfields etc. How do I get round this?
Also, one of the views of my app is a scroll view. Should this be treated differently concerning background images?
Thanks
OK - I found the (very simple one-click) solution: editor>arrange>send to back...
I want to display a number of images in the same position so that it looks like animation. these images should come one after other within microsecond at the moment when the screen loads
There is a very good example of what you want to do on the supports forum knowledge base article Display an animatedGif
See the progress animations section of the BlackBerry knowledgebase article "Implement advanced buttons, fields, and managers"
It has a working code sample for slicing up an image of concatenated frames, and displaying each one for a period of time to create a progress animation.