HorizontalScrollView Scroll Animation

2020. 12. 10. 21:56Android

반응형
val scrollview = findViewById<HorizontalScrollView>(R.id.horizontalScrollView)
scrollview.postDelayed(Runnable {
  ObjectAnimator.ofInt(scrollview, "scrollX", scrollview.bottom).setDuration(5000)
       .start();

}, 3000)


layout.xml
   <HorizontalScrollView
       android:id="@+id/horizontalScrollView"
       android:layout_width="100dp"
       android:layout_height="100dp"
       android:fillViewport="true"
       android:scrollbars="none"
       android:overScrollMode="never"
       android:layout_gravity="center">

       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:orientation="horizontal">

           <TextView
               android:layout_width="100dp"
               android:layout_height="match_parent"
               android:text="left"
               android:textColor="@android:color/black"
               android:background="@android:color/holo_orange_light"/>

           <TextView
               android:layout_width="100dp"
               android:layout_height="match_parent"
               android:text="right"
               android:textColor="@android:color/white"
               android:background="@android:color/black"/>

       </LinearLayout>

   </HorizontalScrollView>
반응형

'Android' 카테고리의 다른 글

Android 11 (Api 30) 파일 저장 관련  (0) 2021.05.27
안드로이드 RecyclerView 성능 개선팁  (0) 2020.12.10
ViewPager  (0) 2020.03.29
Install Referrer API  (1) 2020.03.17
Android Jetpack & KTX  (1) 2020.03.05