scale

Center drawable and scale height

核能气质少年 提交于 2019-12-07 00:58:31
Since I want to support tablets and smartphones without delivering a special "HD" version, I need to scale my Images depending on the resolution of the users device. This is the ImageView source that looks good on the Samsung Galaxy Nexus: <ImageView android:id="@+id/character" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@android:color/transparent" android:scaleType="centerCrop" android:src="@drawable/ma_un1_001" /> But it will cut the image on the nexus 7. When I

move,scale and crop the image in android like facebook profile picture

瘦欲@ 提交于 2019-12-07 00:31:48
问题 I want crop an image in my application.I tried a lot but not succeed. Its challenge to android developer. Is there any idea or reference to implement the features move,scale and crop the image in android like facebook upload profile pic. Now i am able to move, scale and crop and the image.But not consistant like facebook.I want to set fix image scale based on orientation.I attached the screen shot-3. My code as below:- crop_image.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns

How can I scale the background of a button?

让人想犯罪 __ 提交于 2019-12-06 22:38:43
问题 I have the following button: <Button android:id="@+id/buttonok" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableLeft="@drawable/back_no_save" android:text="OK" /> Its appearence is: How can I scale down my drawable and show a small arrow? 回答1: You could use an ImageButton and try android:scaleType ImageView.ScaleType 回答2: I don't hink you can from xml. There's no xml attribute that can do scaling for buttons. You can do it programatically though, in

HTML5 canvas, scale image after drawing it

核能气质少年 提交于 2019-12-06 22:01:02
问题 I'm trying to scale an image that has already been draw into canvas. This is the code: var canvas = document.getElementById('splash-container'); var context = canvas.getContext('2d'); var imageObj = new Image(); imageObj.onload = function() { // draw image at its original size context.drawImage(imageObj, 0, 0); }; imageObj.src = 'images/mine.jpeg'; // Now let's scale the image. // something like... imageObj.scale(0.3, 0.3); How should I do? 回答1: You're thinking about it wrong. Once you've

scale div to background image size

半腔热情 提交于 2019-12-06 20:59:36
I have an image that I need to put divs on top of for links. I did this fine when I initially created the website, but now I am tasked with making it responsive, so I can no longer use -top and left values to position the overlay divs because they don't move with the image. Trying to put the image as a background image so that the position of the overlays can be set and contained within the parent container. I have tried using the background size property (cover, contain, 100%), but they will not make the div show all 400px of its height. setting a max height, using auto, or 100% do not work

Android scale view

◇◆丶佛笑我妖孽 提交于 2019-12-06 16:29:40
I need to scale View by setting the scale factor in percents. I need to set exactly the same param as ScaleAnimation use, because I'm going to scale it using ScaleAnimation in the future. How do I do it? Thanks I've solved the problem by creating animation xml file with duration=0, which sets desired parameters. It is also possible to create such animation via code. Then to apply it, just use: Animation animationInit = AnimationUtils.loadAnimation(context, R.anim.gallery_init); v.startAnimation(animationInit); ahodder This will allow you to use straight up float values (percent) when handeling

CSS transform scale to background image

こ雲淡風輕ζ 提交于 2019-12-06 13:21:00
I have beloved CSS part effecting for a image .split-banner .right-cl:hover img { -webkit-transform: scale(1.1); transform: scale(1.1); } I need to apply above CSS to background image contain in a div element How can I do that? Change background-size on hover. To mimic scale(1.1) use 110% . div { width: 560px; height: 400px; background: url('http://kenwheeler.github.io/slick/img/fonz1.png') center center no-repeat; } div:hover { background-size: 110%; } <div></div> 来源: https://stackoverflow.com/questions/42616579/css-transform-scale-to-background-image

Dimensions of usable space in window (action bar and margin excluded)

我怕爱的太早我们不能终老 提交于 2019-12-06 12:11:29
Disclaimer: I rewrote most of this question, including its title, because I partially figured it out. I'd like to maximize the size of the button on all screen sizes, because it looks silly when it is to small. It should look similar to this: (Sadly, I cannot include a picture, because my reputation is too low.) But if I turn the orientation of the device, for example, the button matches it's parents width, becoming ugly proportioned. (Sadly, I cannot include a picture, because my reputation is too low.) I now have figured out how to get the dimensions of its parent (the LinearLayout) and how

PHP resize image proportionally to a bigger size

本秂侑毒 提交于 2019-12-06 11:31:09
I'm currently working on a script that shows thumbnails from a website on a mobile app, and I'm having problems with the "retina display". If the original image is big enough, I show a thumbnail with the double of the required size, and if it is not, I show it on the required size. Now, my function checks if it can be resized proportionally and if it can't, I resize it to the "min-width" or "min-height" and crop it from the center. Here is the problem: if it detects that the image can't be shown on the double of size, "scale up" the cropped size until it reaches the limits of the original size

Zoom in with affinetransform swing

徘徊边缘 提交于 2019-12-06 11:21:52
I'm working on my personal project using JAVA swing. The project is about drawing a map on a window. The map is zoomable using affinetransform. The problem I'm having here is whenever I zoom in or out the map also shifts instead of zooming in/out on the point of the map that is at the center of the screen private void updateAT() { Dimension d = panel.getSize(); int panelW = d.width; int panelH = d.height; Rectangle2D r = regionList[0].get("Victoria").getShape().getBounds2D(); scaleX = (panelW/r.getWidth()) * zoom; scaleY = (panelH/r.getHeight()) * zoom; AffineTransform goToOrigin =