Coder Social home page Coder Social logo

Comments (4)

KunMinX avatar KunMinX commented on June 1, 2024

见 CustomJsonSampleFragment 示例

from linkage-recyclerview.

minitriangle avatar minitriangle commented on June 1, 2024

我不是数据自定义需求,是实现ILinkagePrimaryAdapterConfig 这个接口,
在 onBindViewHolder(LinkagePrimaryViewHolder holder, boolean selected, String title) 里不能获取当前position, 只有header的标题文字和选中状态,无法自定义处理.(比如特定标题颜色自定义,添加badge,按position 特定处理等)。
期望的实现方法是
onBindViewHolder(LinkagePrimaryViewHolder holder, boolean selected, String title, BaseGroupedItem.ItemInfo ItemInfo)

onBindViewHolder(LinkagePrimaryViewHolder holder, boolean selected, String title, int position)

from linkage-recyclerview.

KunMinX avatar KunMinX commented on June 1, 2024

明白你意思了,可以通过 onBindViewHolder 方法的参数 1 LinkagePrimaryViewHolder 来获取所预期的 position,

recyclerView 存在多种 position,且 API 在不断变动和升级,当初没有直接内定某个 positionAPI 作为 position,也是出于这考虑,

过去人们都在使用 holder.getAdapterPosition,如今 holder.getAdapterPosition 已被废弃,建议使用 holder.getBindingAdapterPosition 来作为 position

  public interface OnPrimaryItemClickListener {
    /**
     * we suggest you get position by holder.getBindingAdapterPosition
     *
     * @param holder primaryHolder
     * @param view   view
     * @param title  groupTitle
     */
    void onItemClick(LinkagePrimaryViewHolder holder, View view, String title);
  }

from linkage-recyclerview.

minitriangle avatar minitriangle commented on June 1, 2024

谢谢,我真没注意LinkagePrimaryViewHolder 的这些方法

from linkage-recyclerview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.