Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

horizontal recyclerview item width half of screen android

   @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.design_item, parent, false);
        v.setLayoutParams(new ViewGroup.LayoutParams((int) (parent.getWidth() * 0.5),ViewGroup.LayoutParams.MATCH_PARENT));

        return new ViewHolder(v);
    }
 
PREVIOUS NEXT
Tagged: #horizontal #recyclerview #item #width #screen #android
ADD COMMENT
Topic
Name
7+8 =