Kotlin高仿微信-项目实践58篇详细讲解了各个功能点,包括:注册、登录、主页、单聊(文本、表情、语音、图片、小视频、视频通话、语音通话、红包、转账)、群聊、个人信息、朋友圈、支付服务、扫一扫、搜索好友、添加好友、开通VIP等众多功能。
效果图:
实现代码:
private fun showPopupWindow(){ var popupView = layoutInflater.inflate(R.layout.wc_moments_pop_view , moment_root, false) var popupWindow = PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true) popupWindow.showAtLocation(moment_root, Gravity.BOTTOM, 0, 0) var window = requireActivity().window //popupWindow在弹窗的时候背景半透明 val params = window.attributes params.alpha = 0.5f window.attributes = params popupWindow.setOnDismissListener { params.alpha = 1.0f window.attributes = params } //拍照小视频 popupView.findViewById(R.id.moments_pop_video).setOnClickListener { popupWindow.dismiss() var bundle = bundleOf(CameraFragment.TYPE_ENTER to CameraFragment.TYPE_MOMENT) navController?.navigate(R.id.action_svideo_camera, bundle) } //选择相册 popupView.findViewById (R.id.moments_pop_album).setOnClickListener { popupWindow.dismiss() openAblum() } //选择小视频 popupView.findViewById (R.id.moments_pop_svideo).setOnClickListener { popupWindow.dismiss() openVideo() } //取消 popupView.findViewById (R.id.moments_pop_cancel).setOnClickListener { popupWindow.dismiss() } }