实现像 Instagram Android 一样的故事回复 [英] Implement story reply like Instagram Android

查看:32
本文介绍了实现像 Instagram Android 一样的故事回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 Instagram,当用户点击 EditText 视图时,会发生下一个场景:

With Instagram when a user clicks on an EditText view the next scenario occurs:

  • 显示表情符号视图[在我的情况下不需要]
  • 故事仍然保持其宽度&高度 [未调整大小] [必需]
  • 键盘已打开[必需]
  • 似乎视图具有透明背景

对于我使用 ADJUST_RESIZE 时的情况,我可以正确显示视图,但故事的 ImageView 必须具有 scaleType [fitXYcenterCrop] 有一些图像的糟糕 UI,如果我没有使用这些 scaleTypes ImageView 将被调整大小并在它旁边有边距.

For my case when I used ADJUST_RESIZE I got the view displayed properly but ImageView of story must have scaleType [fitXY or centerCrop] which has a bad UI with some images, if I did not make it with these scaleTypes ImageView will be resized and have margins beside it.

推荐答案

解决方案是让 ImageView 固定大小.

The solution is to make ImageView with a fixed size.

private fun makeViewFullWidth(view: View) {
        val point = Point()
        // point will be populated with screen width and height 
        activity?.windowManager?.defaultDisplay?.getSize(point)
        val param = view.layoutParams
        param.width = point.x
        param.height = point.y
        view.layoutParams = param
    }

您还可以查看此文章

这篇关于实现像 Instagram Android 一样的故事回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆