我有一个recyclerview适配器,我想将其设置为仅纵向。我似乎找不到任何资源。
有没有办法以编程方式执行此操作?
我可以在onCreateViewHolder中设置它吗?
public class AlarmRecyclerViewAdapter extends RecyclerView.Adapter<AlarmRecyclerViewAdapter.DataObjectHolder> {
@Override
public AlarmRecyclerViewAdapter.DataObjectHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
AlarmRecyclerViewAdapter.DataObjectHolder dataObjectHolder = null;
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_view_alarms, parent, false);
dataObjectHolder = new AlarmRecyclerViewAdapter.DataObjectHolder(view);
return dataObjectHolder;
}
慕的地6264312
当年话下
慕勒3428872
相关分类