In View system we can use #tools:sample/* to show placeholder data.
Example:
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
tools:src="#tools:sample/backgrounds/scenic" />
Using this Android Studio will display a random sample image for us to preview.
My question is, how do we achieve this in Compose?
Related
I do not know how to deal with pixel value and convert it to Dp Unit or percentage Unit.
And even the text, I do not know how to make it adaptive.
How can Jetpack Compose help me with these issues?
Thanks all
For people who have experience with ROS RViz, I am showing an image in an image pane.
Is there a way that I can interact with it? Zoom it? Maximize the window?
Is there a way to interact with the image?
No, because RViz is just a visualization tool rather than a simulator with physics engine (e.g., Gazebo). In RViz, it will display whatever data it receives. This is a one-direction data streaming and no feedback will be sent back. Therefore, if you expect something like the robot can move to some point after you click it in the image, this is not doable (at least not by its default image pane).
There is another way to interact with the robot if needed, which is to use the dynamic reconfiguration. The setup is a kind of similar to how you create a customized ROS message or service. With this, you can change the parameters (via GUI, like to drag on a bar) when the robot is moving (instead of using the static parameters loaded before launching the robot). Note that this GUI will send the new parameters via ROS message in the backend, so this is a bidirectional communication.
Can we zoom the image?
If the pane is fixed and you only want to zoom the image, then no, because again it can only display whatever it receives in the fixed-size pane.
Can we maximize the window?
Yes, you can do this by dragging the window frame, and the image will adjust its display size accordingly.
Also, if you want to keep the window at a larger size, you can save the configuration as a .rviz file and launch RViz as shown in the following.
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find package_name)/rviz/config.rviz" />
You can either manually adjust the window and save it, or open the .rviz file you just created, look up for the window size and change it to the number you want.
Background
I've got a somewhat complex gradient needs in my first Ionic4 PWA (thanks to a talented designer who is ALSO new to PWAs).
Many SVG custom icons are calling many different linear-gradient's through fill:url(#the-gradient); throughout our .scss files. Some of these icons have 9 states (grey, 7 colors, rainbow)
Additionally, these gradients use CSS variables in the stops to further customize the gradients based on themes. These gradients are being stored currently in index.html so that all icons can access them.
<svg aria-hidden="true" focusable="false" style="width:0;height:0;position:absolute;">
<defs>
<linearGradient id="default-icon-graydient" x1="0" x2="0" ,="" y1="1" y2="0">
<stop offset="0%" stop-color="var(--gratiu-dark-grey)"/>
<stop offset="100%" stop-color="var(--gratiu-ml-grey)"/>
</linearGradient>
<linearGradient id="select-icon-gradient" x1="0" x2="0" ,="" y1="1" y2="0">
<stop offset="0%" stop-color="var(--gratiu-current-color)"/>
<stop offset="50%" stop-color="var(--gratiu-current-color)"/>
<stop offset="100%" stop-color="var(--gratiu-next-color)"/>
</linearGradient>
<!--and many, many more...-->
</defs>
</svg>
This system works perfectly on android and on desktop - on iOS however, whether safari or chrome, the icons do not appear.
Things I've tried:
First I added a backup solid color to the fills eg. fill:
url(#select-icon-gradient) var(--gratiu-current-color); this works to keep it functional,
but these gradients are vital bits of information for our users and
they need to be able to see them, not just flat colors
I then tried absolutely linking to the index.html fill: url('http://localhost:8100/index.html#select-icon-gradient'); but this didn't work anywhere
I then tried storing the SVG code in an external SVG, and linking to that absolutely fill: url('http://localhost:8100/app/assets/img/gradients.svg#select-icon-gradient'); still didn't work
I tried moving the gradients back into each SVG file rather than linking to an external files for them Still didn't work.
I thought I was really smart, when I made divs with CSS gradients in their background property, but when it came time to call a path to use for clip-path: url(#the-path), I ran into the same problem as the gradients themselves. Absolutely linking didn't work. Having the clipPath AND the CSS inline on the same page as the icon worked on desktop, but not iOS.
As an aside, I also noticed during this process the same issue with applying an SVG filter (drop shadow). I was able to locate a work around where I can use a containing div and apply a CSS filter on it...but it's not ideal.
The current options I feel I have are:
Replace every single icon style ever with PNGs and use switch cases and if statements to call the appropriate ones which will need to change on the fly.
Create a single SVG for each icon with a rasterized version of each gradient, use CSS to show/hide each individual image.
Obviously a single PNG is lighter weight than a big ol stuffed SVG...but the benefit to the SVG is it would load once and be done with it.
To the questions:
Is there something I haven't tried yet? Anything I've overlooked?
Are SVGs or PNGs better in PWAs anyway?
Why is this so flipping hard?
I would like to embed an existing SVG inside a chart that I am generating using HighCharts. Can someone point to an example on how to do that? I have skimmed through Highcharts documentation, but did not find any references to using existing SVGs.
https://elinux.org/images/c/cb/Raspberry_Pi_Logo.svg
I have seen PNGs embedded in highcharts, like this example
JSFiddle
I have embedded the youtube image from youtube server which is "http://img.youtube.com/vi/0.jpg", now there is no play button shows up on middle of the image as we see usually any youtube videos!
I tried to use the following code to get an image on top of the youtube image but it shows bigger picture, i know why
<a class="fancybox" href="#video">
<img src="/wp-content/themes/mytheme/images/play_button.png" no-repeat width: 0px height:0px; style="background: url(http://img.youtube.com/vi/<?php echo $youtubeid ; ?>/0.jpg) transparent" width="180" height="150"/>
<div id ="video">
// here is my embedded youtube usual code
</div>
both images shown in 180 x 150 size, but thats not what i want.
I want youtube image will be shown in 180 x 150 size and play button image (play_button.png) will be display in middle of the youtube image in small size.
Any clue in css or coding in php will be great favour.
I sorted out quite easily. Just create an image with play button middle and make the surround transparent and then I put this image on top of the youtube thumbnail image. it worked, but video image gets realigned, but it does not look bad though.
<a class="fancybox" href="#bizgenevideo">
<img src="/wp-content/themes/mytheme/images/play-button.png" style="background: url(http://img.youtube.com/vi/<?php echo $youtubeid ; ?>/0.jpg) " width="180" height="148"/>
You can also use a web service
the halgatewood service was taken down, guess too many people bombarded him :)
now it is on github
https://halgatewood.com/easily-add-play-buttons-to-youtube-video-thumbnails/
https://github.com/halgatewood/youtube-thumbnail-enhancer
Here is another service that does the same thing (as suggested by muktesh patel):
http://www.giikers.com/iwc
old answer:
http://halgatewood.com/youtube/
Like this:
http://halgatewood.com/youtube/i/youtube_id.jpg
For example:
http://halgatewood.com/youtube/i/aIgY20n3n0Y.jpg
Related question: How to overlay a play button over a YouTube thumbnail image