寬度大於屏幕寬度的ImageView

[英]ImageView of width Larger than screen width


I'm implementing an animation which displays scrolling image. I need to display a image in its original size even if the width is more than the screen width and then have to animate it. Please tel me how to place image like that.

我正在實現一個顯示滾動圖像的動畫。我需要以原始大小顯示圖像,即使寬度大於屏幕寬度,然后必須為其設置動畫。請告訴我如何放置這樣的圖像。

3 个解决方案

#1


2  

Check out the different scaletypes here: http://bon-app-etit.blogspot.be/2014/01/imageview-scaletypes.html

查看不同的scaletypes:http://bon-app-etit.blogspot.be/2014/01/imageview-scaletypes.html

I think you'll need android:scaleType="centerCrop"

我想你需要android:scaleType =“centerCrop”

#2


0  

Try using scaleType in ur imageview xml,

嘗試在ur imageview xml中使用scaleType,

  android:scaleType="fitXY"

#3


0  

There are couple of things you can do and it depends on the behavior you want to implement. A quick two solutions are:

您可以做幾件事,這取決於您要實施的行為。快速的兩個解決方案是:

  1. You can use ScrollView with your image in it and by touching it you can move it left or right. Example solution you can find here: Displaying an image larger than the device's screen

    您可以將ScrollView與其中的圖像一起使用,並通過觸摸它可以向左或向右移動。您可以在此處找到示例解決方案:顯示大於設備屏幕的圖像

  2. You can use absolute layout (although this layout is already deprecated) and place your image in it. Make the layout width and height be the same as your image.

    您可以使用絕對布局(雖然此布局已被棄用)並將圖像放入其中。使布局寬度和高度與圖像相同。

The animation can be done with many ways:
1. On touche event handling
2. Fling with scroller or gesture detector
3. Accelerometer tilt

動畫可以通過多種方式完成:1。觸摸事件處理2.使用滾動條或手勢檢測器拍攝3.加速度計傾斜

Hope it directs you to the right solution.

希望它能引導您找到正確的解決方案。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/01/15/72584cdfb61fec56bd79b300616230ca.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com