public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
viewHolder.button.setText("button" + +position);
if(position == 0){
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams);
viewHolder.button.getLayoutParams();
params.height = 200;
params.width = 200;
viewHolder.itemView.setLayoutParams(params);
}else{
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams);
viewHolder.button.getLayoutParams();
params.height = RecyclerView.LayoutParams.WRAP_CONTENT;
params.width = RecyclerView.LayoutParams.WRAP_CONTENT;
viewHolder.itemView.setLayoutParams(params);
}
}
Using this code in the adapter of GridView
I'm trying to give a custom size to the first item of GridView
, but it changes size of all items in the row but items of other columns stay normal.
So how can I make only 1 item to be changed in GridView
?