Search code examples
androidimageviewhorizontal-scrollingbackground-foreground

How can i add the following kind of animation for my Imageview


please find attached my video, which shows the animation/design for my Imageview. How can i add something like this?first you see the normal imageview

after scrolling, the text goes into the foreground and the Image into the Background. How is this possible


Solution

  • if you want to achieve this simply you can do it like this

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="100dp" />
    
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            <View
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:background="@android:color/transparent" />
    
    
            <!--your layout -->
    
        </LinearLayout>
    
    </ScrollView>
    </RelativeLayout>