How to create a view that is bigger than the screen?

Ok I got an answer. It is not very nice because it uses a deprecated View class but it works at least on my current testing screen resolution other resolutions are tested tomorrow.

I wrapped the view that I wanted to expand beyond the screen in an absolute layout like this:

<AbsoluteLayout
  android:layout_width="wrap_content"
  android:layout_height="fill_parent"
  android:layout_alignParentBottom="true">

  <ImageView
     android:id="@+id/content"
     android:layout_width="600dip"
     android:layout_height="420dip"
     android:scaleType="centerCrop"
     android:layout_x="-200dip"
     android:layout_y="60dip"
     android:src="https://stackoverflow.com/questions/3813049/@color/testcolor" />

</AbsoluteLayout>

The -200 x coordinate makes the view stick 200dip out of the left side of the screen. If I’m animating the view those parts that are outside the screen will gradually become visible.

Leave a Comment