I have an activity in portrait mode. Inside the activity I want to visualize an image (not matter dimensions and proportions) that automatically fit the exactly width of screen (imagine a normal gallery app). To do this, I place the ImageView in a RelativeLayout, in this way:
<RelativeLayout
android:id="@+id/relLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp">
<ImageView
android:id="@+id/greatImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"/>
</RelativeLayout>
and it's ok, BUT now I need to move the ImageView a certain amount of DP down (ex 300dp) so that the bottom of ImageView comes out of the screen (this is because later I will start an animation that will bring the ImageView in the correct position).
If I set layout_marginTop="300dp" for RelativeLayout the ImageView will be scaled down, and is boundaries stop matching the parent width.
I know that I can set the scaleType of ImageView to center, but this way the ImageView stop scaling correctly to adeguate his dimensions to the screen.
The only solution that I found is to wrap RelativeLayout inside a ScrollView, and move the marginTop of the same ScrollView.
There is another way? Hope I explained my problem, thanks.