Appcelerator Titanium - don't stretch image to ImageView dimentions -
i have image of size 1024x1024 , want have background imageview
object. i've set imageview
height , width size of device , loaded image - happens image shows entire image squeezed given dimensions.
what see not entire image - want scale show centered, , parts of image don't fit screen not show. end result should setting height , width whatever disposable overflowed , hidden.
how can set image not stretch?
what looking clipped image. affect best achieved using combination of view clipping turned on , imageview.
as example, we'll use large image , code below.
<alloy> <window class="container" backgroundcolor="#000"> <view clipmode="titanium.ui.ios.clip_mode_enabled" width="200"> <imageview image="/images/moonset_over_eso's_very_large_telescope.jpg" height="2336" width="3504"/> </view> </window> </alloy>
note have enabled clipping on parent view, , using define actual width want rendered on screen. imageview used actual width / height of image rendered. because not setting top,left,right,bottom properties, imageview render centered in parent view, overflow hidden.
this provides desired effect shown in image below.
Comments
Post a Comment