我有一个可扩展的回收站视图,它会在我的活动开始时显示。但是默认情况下,父视图是折叠的。
我尝试在我的父视图持有者中设置 setExpanded(true) ,如下所示:
public PersonParentViewHolder(View itemView) {
super(itemView);
mPersonTitleTextView = (TextView) itemView.findViewById(R.id.parent_list_item_person_title_text_view);
mParentDropDownArrow = (ImageButton) itemView.findViewById(R.id.parent_list_item_expand_arrow);
setExpanded(true);
}
但这似乎没有帮助。
这是ParentViewHolder的创建
@Override
public PersonParentViewHolder onCreateParentViewHolder(ViewGroup viewGroup) {
View view = mInflater.inflate(R.layout.person_parent_layout, viewGroup, false);
return new PersonParentViewHolder(view);
}
如果有帮助的话,这里就是创建回收站视图的地方
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.person_fragment_layout, container, false);
recyclerView = (RecyclerView) view
.findViewById(R.id.person_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
updateUI(view);
return view;
}
提前致谢!