-6
 override fun itemclick(position: Int) {
        binding.progressbar.visibility=View.VISIBLE
        binding?.barcode?.setImageBitmap(exchngeViewModel.getQrImageBitmap(qrCodeData[position], this!!.activity!!))
        showDetail(position)
        binding.progressbar.visibility=View.GONE
    }    

fun getQrImageBitmap(data: String, context: Context): Bitmap? {
        bitMap = AppUtils.TextToImageEncode(data, context, bus) 
        return this!!.bitMap
    }

这是我的代码,我想dialog在项目点击上显示进度,它应该在那个时候关闭,直到 getQrImageBitmapshowDetail 功能完成,但我没有工作,请建议我如何实现这一点,如何在项目点击上显示和隐藏细节。谢谢!

4

1 回答 1

0

showDetail()在方法内添加进度条

  fun showDetail(position: Int) {
    SharedPreferenceUtils.setExchangePagePostion(this!!.activity!!, position)
    binding?.textHeader?.text = exchangeData[position]
    binding?.backButton?.visibility = View.VISIBLE
    binding?.recyclerView?.visibility = View.GONE
    binding?.barcode?.visibility = View.VISIBLE
    binding?.header1?.setBackgroundResource(R.color.colorOrangeGray)
    binding?.exchangeButton?.visibility = View.VISIBLE


    binding.progressbar.visibility=View.GONE
}
于 2018-01-02T05:06:43.443 回答