Github

Github 好用分享Android SheetSelection(底下彈跳視窗)

1.先導入函示庫(build.gradle: Project)

allprojects {
  repositories { 
     maven { url 'https://jitpack.io' }
   }
}

2.先導入函示庫(build.gradle: Module)

dependencies {
     implementation 'com.github.minibugdev:sheetselection:0.0.2'
}

3.程式碼範例

a.創建要顯示資料

private val items = listOf(
    SheetSelectionItem("1", "第一張", R.drawable.a),
    SheetSelectionItem("2", "第二張", R.drawable.b),
    SheetSelectionItem("3", "第三張", R.drawable.c)
)

b.創建選單

SheetSelection.Builder(this)
        .title("選單")
        .items(items)
        .theme(R.style.Theme_Custom_SheetSelection)
        .showDraggedIndicator(true)
        .onItemClickListener { item, position ->
            Toast.makeText(this, "itemposition", Toast.LENGTH_SHORT).show()
        }.show()

4.效果展示

發表迴響