我需要根据屏幕高度更改cardView高度。如何在TileAdapter中获得屏幕高度?
public static class ViewHolder extends RecyclerView.ViewHolder implements ItemTouchHelperViewHolder {
public CardView cardView;
// ........................
public ViewHolder(final View itemView) {
super(itemView);
cardView = (CardView) itemView.findViewById(R.id.card_view);
Display mdisp = itemView.getContext().getWindowManager().getDefaultDisplay();
Point mdispSize = new Point();
mdisp.getSize(mdispSize);
height = mdispSize.y;
Toast.makeText(itemView.getContext(),height,Toast.LENGTH_SHORT).show();
cardView.setMinimumHeight(height);
}
// ..........................
}