aspect-ratio

How to set 9-patch background for ViewPager, that will put the pages inside, and keep aspect ratio?

夙愿已清 提交于 2019-12-11 03:25:20
问题 Background I have a ViewPager (of images pages), which needs to show its content inside an image that should keep its aspect ratio. The problem Problem is, when I just set a 9-patch for any kind of ViewGroup (including the ViewPager), the image just stretches (not keeping the aspect-ratio), and for some reason, it doesn't even respect the content bounding box I've set to it (in the 9-patch). It occurs even if I put the ViewPager in a FrameLayout that has the 9-patch background instead. What I

Aspect ratio behaviour of <canvas> - internal dimensions and element size

时光毁灭记忆、已成空白 提交于 2019-12-11 03:22:49
问题 As you know, the <canvas> element in HTML5 has an internal size, set via elm.width and elm.height where elm is the DOM element. The element within the DOM itself can have a different box size, set via CSS. When the two differ, the browser automatically stretches the contents of the <canvas> to fit the content box size. Can this behaviour be adjusted without an extra element? Can it be set to something like background-size: contain so that it keeps the aspect ratio of the inner canvas size? As

How I can do a button with left/right side as rounded as circle

老子叫甜甜 提交于 2019-12-11 00:33:23
问题 I'm trying to do a button with the sides rounded, but when I change the size of screen the button sides left to be rounded as circles, doesn't mantain the aspect ratio (I think). I want to have the next togglebutton in everysize. How I can do an XML with the sides rounded for every resolution? I've read this, but is not a solution (How to make the corners of a button round?) 回答1: The other answers are correct... almost: if you will set corners to some value (let's say 20dp), but your button

Zoom in/out how do I keep the aspect ratio?

巧了我就是萌 提交于 2019-12-10 20:47:42
问题 Working Example: http://jsfiddle.net/4jmY2/4/ If you Zoom in/out (ctrl +/-) you will see the elements move around, how can I keep the aspect ratio so the content will remain the same no matter what size? HTML <div class="check_box"> <div class="check"> <div class="your_name">Your Name</div> <div class="bank_name">Your Bank Name</div> <div class="check_number_top">1001</div> <div class="your_address">Your Address</div> <div class="bank_address">Bank Address</div> <br /> <div class="date">Date

Resizing Tkinter Frames with fixed aspect-ratio

旧街凉风 提交于 2019-12-10 15:59:00
问题 I'm looking for a way to make Tkinter Frames behave somewhat like this while resizing: from Tkinter import * w = Tk() w.aspect(1,1,1,1) w.mainloop() So I'd like this code here: import Tkinter as tk from Tkconstants import * r=tk.Tk() content_frame=tk.Frame(r,borderwidth=5,relief=GROOVE) content_frame.grid(row=0,column=0,sticky=(N,S,E,W)) tk.Label(content_frame,text='content').pack() pad_frame=tk.Frame(r,borderwidth=5,relief=GROOVE) pad_frame.grid(row=1,column=0,sticky=(N,S,E,W)) tk.Label(pad

UIImageView in custom UITableViewCell not respecting Aspect Fit mode

只愿长相守 提交于 2019-12-10 15:41:18
问题 I have a table view that uses a custom UITableViewCell that I created on a NIB. In this custom cell I have a square image view to show logos. The images are already thumbnail-size but they have different sizes (some are squares and some are not). I simply specified my UIImage in my custom cell to have a View Mode of "Aspect Fit", so as to make all of them display on a square but without losing their aspect ratio. The problem is that I keep getting an image that fills the height of my row and

Set UIImageView AspectRatio constraint programmatically in swift 3

霸气de小男生 提交于 2019-12-10 14:45:49
问题 I have an UIImageView in storyboard which AspectRatio is 1:1, that I want to change to 2:1 programmatically in ViewController in some cases. I create reference of that constraint in ViewController but unable to set the constraint. 回答1: You can change constraint programmatically in swift 3 let aspectRatioConstraint = NSLayoutConstraint(item: self.YourImageObj,attribute: .height,relatedBy: .equal,toItem: self.YourImageObj,attribute: .width,multiplier: (2.0 / 1.0),constant: 0) self.YourImageObj

Large images don't render in Chrome?

江枫思渺然 提交于 2019-12-10 14:45:48
问题 Very large images will not render in Google Chrome (although the scrollbars will still behave as if the image is present). The same images will often render just fine in other browsers. Here are two sample images. If you're using Google Chrome, you won't see the long red bar: Short Blue http://i.stack.imgur.com/ApGfg.png Long Red http://i.stack.imgur.com/J2eRf.png As you can see, the browser thinks the longer image is there, but it simply doesn't render. The image format doesn't seem to

ImageAreaSelect: preselect biggest thumbnail possible respecting aspectRatio

只愿长相守 提交于 2019-12-10 10:55:01
问题 This is how I first tried: $('#thumbnail').imgAreaSelect({ x1: 5, y1: 5, x2: $('#thumbnail').width(), y2: $('#thumbnail').width()*0.66, aspectRatio: '1:0.66' }); But some of the cropped image stay off the overflow... This seems to make a preselection for most of the image resolutions I tried... var thwidth = $('#thumbnail').width(); var thheight = $('#thumbnail').height(); aspectRatio = 0.66; $('#thumbnail').imgAreaSelect({ x1: 5, y1: 5, x2: thwidth - 80, y2: (thwidth - 80) * aspectRatio,

Detect aspect ratio - HTML5 video

浪尽此生 提交于 2019-12-10 08:25:55
问题 Is it possible to detect the aspect ratio of an HTML5 video element? I know the video will just shrink to fit in the <video> element's dimensions, but I want to detect the aspect ratio of the source video. That way you could remove any black bars. Sorry I don't see this answered anywhere else. 回答1: Pasting from another StackOverflow answer: https://stackoverflow.com/a/4129189/1353189 <video id="foo" src="foo.mp4"></video> var vid = document.getElementById("foo"); vid.videoHeight; // returns