如何在RecycleView中返回每行的高度?我需要它在RecycleView中的滚动条高度,如iOS中的heightForRowAtIndexPath。
我对RecyclerView.Adapter
提供了以下RecyclerView
。
class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
private String[] items = {"My items"};
public static class ViewHolder extends RecyclerView.ViewHolder {
public View mTextView;
public ViewHolder(View v) {
super(v);
mTextView = v;
}
}
public MyAdapter(String[] myDataset) {
//items = myDataset;
}
@Override
public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_view_text_item, parent, false);
ViewHolder vh = new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
((TextView)holder.mTextView.findViewById(R.id.textItemTextView)).setText(items[position]);
}
@Override
public int getItemCount() {
return items.length;
}
}
但是行具有不同的高度,并且在滚动期间滚动更改。
答案 0 :(得分:0)
您可以使用以下内容:
test._dummy_indexes_2p23