Android开发案例分享-指向某个view的弹框
往往点击更多,或者更多的图标会出现指向它的弹框,让用户选择
一、思路:
用BubbleAttachPopupView
二、效果图:
三、关键代码:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val iv_msg_more = findViewById<ImageView>(R.id.iv_msg_more)
iv_msg_more.setOnClickListener {
XPopup.Builder(this)
.atView(iv_msg_more)
.isLightStatusBar(true)
.hasNavigationBar(false)
.hasShadowBg(false)
.asCustom(
MoreBubbleAttachPopup(this)
.setArrowOffset(-8) //气泡箭头偏移
// .setBubbleBgColor(Color.RED) //气泡背景
.setArrowWidth(16)
.setArrowHeight(12)
.setBubbleRadius(8)
.setArrowRadius(4)
).show()
}
}
}
四、项目demo源码结构图:
有问题或者需要完整源码demo的可以看简介联系我,也可以私信我,我每天都看私信的