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(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 |