我尝试在ViewPager中设置MaterialShowcaseView,但是它不起作用。我将这个库用于展示https://github.com/deano2390/MaterialShowcaseView
我在onCreate()中调用presentShowcaseSequence(),但是它不起作用。
这是我的代码:-
<RelativeLayout
android:id="@+id/relforswipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/examBtnLayout"
android:layout_below="@+id/exam_toolbar_top"
android:padding="5dp">
<android.support.v4.view.ViewPager
android:id="@+id/examViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
ExamActivity.kt:-
private fun presentShowcaseSequence() {
val config = ShowcaseConfig()
config.delay = 500
val sequence = MaterialShowcaseSequence(this, SHOWCASE_ID)
sequence.setConfig(config)
sequence.setOnItemShownListener(object : MaterialShowcaseSequence.OnSequenceItemShownListener {
override fun onShow(itemView: MaterialShowcaseView, position: Int) {
}
})
sequence.addSequenceItem(
MaterialShowcaseView.Builder(this)
.setTarget(examViewPager)
.setDismissText(R.string.next)
.setTitleText(R.string.questions)
.withRectangleShape()
.setContentText(R.string.input_question)
.build()
)
sequence.start()
}