Help with cropping the top of an ImageView

by knavewave » Fri, 20 Nov 2009 15:33:41 GMT

Sponsored Links
 I am trying to place a background image within a HorizontalScrollView
such that the entire width of my image is scrollable and such that the
excess height will be cropped. This seems like it should be
straightforward: no scaling, no centering... just peg it to the bottom
left corner and lop off the top. After going through various
permutations of 'scaleType' and juggling things around the layout, I
am beginning to think I can do almost everything except for what I
described above :)

Here is a basic dump of my layout


      ... Other UI elements

The closest I have got so far, is by using the 'scaleType=centerCrop".
This will give me the correct horizontal scrolling and vertical image
cropping (no scaling just clips the excess). The only problem, is that
the vertical clipping is such that an equal amount is clipped from
both the top and bottom, when what I am shooting for is to only have
the top clipped.

Please help! The amount of time I have sunk into this one problem is
beginning to be a bit embarrassing :)


Other Threads

1. toolchain to build kernel

Hello All,

    I am trying to build a kernel image to run in the emulator and I
am following

   I have downloaded the android source (
download) and it has 2 toolchains arm-eabi-4.3.1 and arm-eabi-4.2.1.
Which one should be used to build the kernel?

Thanks for your replies,


2. How to explicitly launch the system's Home application by code?

"Here are some examples of other operations you can specify as intents
using these additional parameters:


      ACTION_MAIN with category CATEGORY_HOME -- Launch the home screen."


3. Turning GPS ON/OFF

4. Starting service at bootup time

5. Wireless doesn't work after official 1.1 update for ADP1.

6. Diplay a Euro sign for the currency

7. Developer challenge - SFR