Android(Kotlin)

Android Shimmer

----___<<<<< 2022. 10. 22. 23:56

 

 

 

implementation "com.facebook.shimmer:shimmer:0.5.0"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:orientation="vertical">

    <TextView
        android:text="A"
        android:textSize="30dp"
        android:layout_width="100dp"
        android:layout_height="50dp"/>

    <TextView
        android:text="B"
        android:textSize="30dp"
        android:layout_width="100dp"
        android:layout_height="50dp"/>

</LinearLayout>

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:orientation="vertical">

    <TextView
        android:text="1"
        android:background="@color/cardview_shadow_start_color"
        android:textSize="30dp"
        android:layout_width="100dp"
        android:layout_height="50dp"/>

    <TextView
        android:text="2"
        android:background="@color/cardview_shadow_start_color"
        android:textSize="30dp"
        android:layout_width="100dp"
        android:layout_height="50dp"/>

</LinearLayout>

 

 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.facebook.shimmer.ShimmerFrameLayout
        android:id="@+id/sfl_sample"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:shimmer_auto_start="true">

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

            <include layout="@layout/rv_item_shimmer" />
            <include layout="@layout/rv_item_shimmer" />
            <include layout="@layout/rv_item_shimmer" />
            <include layout="@layout/rv_item_shimmer" />
            <include layout="@layout/rv_item_shimmer" />


        </LinearLayout>

    </com.facebook.shimmer.ShimmerFrameLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

 

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val sfl_sample = findViewById<ShimmerFrameLayout>(R.id.sfl_sample)
        sfl_sample.stopShimmer()


    }

}

 

 

 - 참조

 

https://leveloper.tistory.com/214

 

[Android] 스켈레톤 로딩 화면 구현하기 - Facebook shimmer library

사용자가 어떠한 요청을 했는데 화면에 아무런 변화가 없다면 어떤 느낌을 받을까요? 요청이 제대로 들어갔는지, 앱이 고장 난 건지 사용자는 알 수가 없습니다. 따라서 데이터를 로딩 중에는

leveloper.tistory.com

 

'Android(Kotlin)' 카테고리의 다른 글

Android Timber  (0) 2022.11.04
Andorid AlarmManager  (0) 2022.10.29
Android ViewModel Context  (0) 2022.10.20
Android BOOT_COMPLETED  (0) 2022.10.20
Simple ForegroundService  (0) 2022.10.15