Android 游戏闯关
生活随笔
收集整理的這篇文章主要介紹了
Android 游戏闯关
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
GameStageView
游戲闖關View、闖關文字、解鎖 + 未解鎖、2字形路徑
預覽
資源
| AAR | game_stage_view.aar |
| GitHub | GameStageView |
| Gitee | GameStageView |
Maven
1.build.grade | setting.grade
repositories {...maven { url 'https://jitpack.io' } }2./app/build.grade
dependencies {implementation 'com.github.RelinRan:GameStageView:2022.7.29.1' }xml
注意:Item個數過多情況請嵌套NestedScrollView或者ScrollView
<androidx.widget.GameStageViewandroid:id="@+id/game_stage"android:layout_width="match_parent"app:itemHeadSrc="@mipmap/ic_head"android:layout_height="wrap_content" />attrs.xml
<!--item寬度--> <attr name="itemWidth" format="dimension" /> <!--item高度--> <attr name="itemHeight" format="dimension" /> <!--item圓角大小--> <attr name="itemRadius" format="dimension" /> <!--item文字大小--> <attr name="itemTextSize" format="dimension" /> <!--分割線顏色--> <attr name="itemDividerColor" format="color" /> <!--水平分割線寬度--> <attr name="itemDividerHorizontalWidth" format="dimension" /> <!--水平分割線高度--> <attr name="itemDividerHorizontalHeight" format="dimension" /> <!--垂直分割線寬度--> <attr name="itemDividerVerticalWidth" format="dimension" /> <!--垂直分割線高度--> <attr name="itemDividerVerticalHeight" format="dimension" /> <!--item總數--> <attr name="itemCount" format="integer" /> <!--列數--> <attr name="columnCount" format="integer" /> <!--當前關1開始--> <attr name="itemPosition" format="integer" /> <!--解鎖文字顏色--> <attr name="itemUnlockTextColor" format="color" /> <!--未解鎖文字顏色--> <attr name="itemLockTextColor" format="color" /> <!--解鎖背景顏色--> <attr name="itemUnlockBackgroundColor" format="color" /> <!--未解鎖背景顏色--> <attr name="itemLockBackgroundColor" format="color" /> <!--內部左間距--> <attr name="InnerPaddingLeft" format="dimension" /> <!--內部右邊距--> <attr name="InnerPaddingRight" format="dimension" /> <!--內部上間距--> <attr name="InnerPaddingTop" format="dimension" /> <!--頭像資源--> <attr name="itemHeadSrc" format="reference" /> <!--頭像大小--> <attr name="itemHeadSize" format="dimension" /> <!--頭像邊線顏色--> <attr name="itemHeadStrokeColor" format="color" /> <!--頭像邊線寬度--> <attr name="itemHeadStrokeWidth" format="dimension" /> <!--頭像箭頭顏色--> <attr name="itemHeadArrowColor" format="color" /> <!--頭像箭頭上間距--> <attr name="headArrowMarginTop" format="dimension" />使用
GameStageView game_stage = findViewById(R.id.game_stage); //頭像資源 game_stage.setItemHeadSrc(R.mipmap.ic_head); //關數 game_stage.setItemCount(26); //已闖關數 game_stage.setItemPosition(13); //Item點擊事件 game_stage.setOnGameItemClickListener((position, lock) -> {Log.e("Game", "position=" + position + ",lock=" + lock); }); //頭像點擊事件 game_stage.setOnGameHeadClickListener((position, lock) -> {Log.e("Game", "position=" + position + ",lock=" + lock); });總結
以上是生活随笔為你收集整理的Android 游戏闯关的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 抖音盒子、得物、小红书混战社交电商
- 下一篇: 我靠着这套学习视频+文档,自学Andro