I know that there is a way to support zoom in java: webview.getSettings().setSupportZoom(true). But I've been searching for a while for this in Kotlin. And yes, I have tried using the converter try.kotlinlang.org but It gives me the same piece of code. Does somebody know how to support zoom in Kotlin?
Why not simply:
var webView: WebView = view.findViewById(R.id.webview)
webView.settings.setSupportZoom(true)
Update
As per your comments you would want to do this as well:
webView.settings.builtInZoomControls = true // enable pinch to zoom and zoom controls
webView.settings.displayZoomControls = false // hides the zoom controls so you can just pinch to zoom
Related
hello i'm trying to customize here navigation inside my app
is it possible to change the thickness of the route line inside the nav (
similar thread Android HereMaps SDK Route Line Thickness?
)?
is it possible to change the maximum/minimum zoom while I'm using NavigationManager.MapUpdateMode.ROADVIEW?
and finally is it possible to move mapView.positionIndicator at the bottom of the screen inside navigation?
Thickness of MapRoute object can't be adjusted.
There is no way to adjust max/min zoom level for ROADVIEW, you can try ROADVIEW_NOZOOM instead and control zooming by yourself.
Please use Map.setTransformCenter to control the map movement center (number of pixel). For example, you have an 1080*1920 screen, you can use map.setTransformCenter(new PointF((540.0), (1162.8))); to shift the map movement center lower.
Yes you can change thickness of MapRoute
If you really want to use MapRoute You can use CustomizableScheme for that :
CustomizableScheme scheme = map.createCustomizableScheme("newCustomScheme", Map.Scheme.NORMAL_DAY);
scheme.setVariableValue(CustomizableVariables.RouteStyle.ROUTESTYLE_1_WIDTH , *Width in pixels* , range);
you can check the CustomizableVariables.RouteStyle Class
if you want to use Polylines tho you can try this :
MapPolyline mp = new MapPolyline(new GeoPolyline(route.getRouteGeometry()));
mp.setLineWidth(20);
map.addMapObject(mp);
I am trying to load a url into a webview, its actually a screen share stream into a phone app.
I have a couple of issues I need help with.
WebView starts always zoomed at the top left corner
There are zoom controls and fit to scale button, and after zooming you can move around by touch, however the two finger pinch zoom does not work.
Adding the setWebViewClient as below, enables pinch zoom but gives two more problems; there are additional -+ buttons, and zooming by pinch the original -+/fit to scale buttons become zoomed as well
screenShareWebView.settings.useWideViewPort = true
screenShareWebView.settings.loadWithOverviewMode = true
screenShareWebView.settings.setSupportZoom(true)
screenShareWebView.settings.builtInZoomControls = true
screenShareWebView.settings.displayZoomControls = true
screenShareWebView.scrollBarStyle = WebView.SCROLLBARS_INSIDE_OVERLAY
screenShareWebView.isScrollbarFadingEnabled = true
screenShareWebView.settings.javaScriptEnabled = true //needs to be true or else it doesnt work
screenShareWebView.loadUrl(it)
the pinch zoom is enabled (with the extra buttons) with
screenShareWebView.setWebViewClient(object : WebViewClient() {
override fun onPageFinished(view: WebView, url: String?) {
val javascript ="javascript:document.getElementsByName('viewport'[0].setAttribute('content', 'initial-scale=1.0,maximum-scale=10.0');"
view.loadUrl(javascript)
}
})
So i need to start fit to scale, enable pinch zoom if possible and dont add extra buttons
I am building an Android Application and I am using AChartEngine to display a graph and values I obtain.
I am able to graph the values I have properly. However, once the user zooms in and pans around my graph, it becomes difficult to view the data. One option I considered is to display a "redraw graph" button where once the user clicks it, the graph would redraw itself to the original state, zoom and pan would also reset.
Here's by code thus far:
public void redrawGraph(View view){
chartView.repaint();
}
where redrawGraph is a the onClick function of my button and chartView is an object of type GraphicalView.
However, that does seem to do anything as it only repaints changes in my graph (if I added/removed series renderers, series, etc).
How can I reset the zoom and pan of graphs in AChartEngine?
My answer refers to XY/time charts. First you have to enable the external zoom feature in every renderer you use. The snippet below shows the code for accomplishing this:
yourMultipleSeriesRenderer.setExternalZoomEnabled(true);
In your method redrawGraph you then have to execute the command shown below:
public void redrawGraph(View view) {
chartView.zoomReset();
}
This works great for me. If you need any further information leave a comment.
Put this in your Multiple Series Render
multiRenderer.setZoomButtonsVisible(false);
// setting pan enablity which uses graph to move on both axis
multiRenderer.setPanEnabled(true, false);
// setting click false on graph
multiRenderer.setClickEnabled(false);
// setting zoom to false on both axis
multiRenderer.setZoomEnabled(true, false);
// setting lines to display on y axis
multiRenderer.setShowGridY(true);
// setting lines to display on x axis
multiRenderer.setShowGridX(true);
// setting legend to fit the screen size
multiRenderer.setFitLegend(true);
// setting displaying line on grid
multiRenderer.setShowGrid(true);
// setting zoom to false
multiRenderer.setZoomEnabled(false);
// setting external zoom functions to false
multiRenderer.setExternalZoomEnabled(false);
I am developing a game in libgdx where I need to zoom in and zoom out a popup for clearing every stage in the game. Could you please guide me how to do zoom effects in libgdx.
Just a note I am doing this for android device.
Kindly assist.
You can zoom using the property of same name of OrtographicCamera.
camera.zoom = 1; //Normal zoom (default)
camera.zoom = 2; //Zoomed in
camera.zoom = 0.5F; //Zoomed out
If you mean "zooming" a particular image, then just make it bigger and smaller.
To make your sprite larger or smaller use sprite.setScale, where 1 is the default size, 2 is 2 time bigger, 0.5 half.. you understand.
But if you want to make like a screen transition better use camera zoom, as described in the post above.
I am trying to implement an application in which it will load an image and zoom to a face if there is any when a button is clicked. I have used the face detection APIs for the detection part and retrieved the midpoint of a face. Now, the problem that I am facing is zooming to the area around the face. I am using a custom Imageview to display the image.
Couldn't find anything much useful in previous SO questions.
Thanks in advance.
I would suggest you to use Mike Ortiz's TouchImageView, pay attention to the DoubleTapZoom, that's the class which is going to be used. You may write your own class extending TouchImageView which supports zoom to face, something like this:
private void zoomToFace (float faceX, float faceY) {
DoubleTapZoom zoom = new DoubleTapZoom(targetZoom, faceX, faceY, false);
postDelayed(zoom, 1000/60);
}