cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.
Apache License 2.0
7.22k stars 1.42k forks source link

StickyHeader Views are unaccessible #123

Open zelin opened 9 years ago

zelin commented 9 years ago

I am trying to add a StickyHeaderView along with Parallex header using item decorator,

The Layout is added and it works fine however no views inside headerView are accessible

Here is the standard code

@Override public long generateHeaderId(int position) { if (getItem(position) != null) return getItem(position).id; else return -1; }

@Override public HeaderViewHolder onCreateHeaderViewHolder(ViewGroup viewGroup) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.listview_header_profile, viewGroup, false); // initializing views and then let's say setting onClicks, setText to textViews nothing seems to work strangly. LinearLayout nationLayout = (LinearLayout) view.findViewById(R.id.nationsLayout);

nationLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { moodLayoutClick.moodLayoutClicked(Constants.MOOD_TYPE_NATION); } });

    return new HeaderViewHolder(view);
}

@Override public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {

}

public class HeaderViewHolder extends RecyclerView.ViewHolder { protected TextViewWithFont nationBtn; //

    HeaderViewHolder(View view)
    {
        super(view);

Tried initializing here too. Doesn't work } }

What actually is going on? 
cymcsg commented 9 years ago

Do you mean you want to set a click method on it ? Maybe you can try #68 as this issue said.

zelin commented 9 years ago

@cymcsg StickeryHeader attached view "R.layout.listview_header_profile" has multiple Views that needs to be clicked and a couple of TextViews. I can't access any. I don't want to put click on just entire headerView.

zelin commented 9 years ago

Any fix to this issue?

cymcsg commented 9 years ago

@zelin Not any update on this right now.

tajoumal commented 5 years ago

Struggling with this too