Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好 我在adapter中使用多布局 可是position总是获取不正确,请问有办法解决吗 #13

Open
gxs-gc opened this issue May 30, 2019 · 4 comments

Comments

@gxs-gc
Copy link

gxs-gc commented May 30, 2019

No description provided.

@gxs-gc
Copy link
Author

gxs-gc commented May 30, 2019

大神 有看的吗

@chenlin030922
Copy link
Owner

你可以看看我写的Demo的,由于从Adapter中获取到的position是不准的,所以是保存在list的每个Item中的

@gxs-gc
Copy link
Author

gxs-gc commented Jun 5, 2019

你好 我按照你上面说的写了,出现了一个问题,在当前卡片快滑动出去的时候,下一张卡片还是原来列表中的数据,当完全划出时,会闪一下变成新的布局。所以现在我想达到的效果是,当在滑动的过程中,下一个card显示的是另外一个布局,请问有办法吗
多布局的实现我写在一个布局中,通过控制显示隐藏来实现的。

@gxs-gc
Copy link
Author

gxs-gc commented Jun 5, 2019

var bean = datalist[position]
var num = if (position == 0) {
tempList?.indexOf(bean)
} else {
-1
}

    if (num!= -1 &&num!=0 && num % 5 == 0) {
        holder.publisherAdView.visibility = View.VISIBLE
        holder.rl_content.visibility = View.GONE
       ...
    } else {
        holder.publisherAdView.visibility = View.GONE
        holder.rl_content.visibility = View.VISIBLE
      .....
        holder?.img?.setRemoteImagePicass(bean.avatar, R.mipmap.holder)
       ...
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants