Answers for "horizontal recyclerview item width half of screen android"

0

horizontal recyclerview item width half of screen android

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(context).inflate(R.layout.row, parent, false);
        view.layoutParams = ViewGroup.LayoutParams((parent.width * 0.5).toInt(),ViewGroup.LayoutParams.MATCH_PARENT)
        return ViewHolder(view);
    }
Posted by: Guest on July-02-2021
0

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);
    }
Posted by: Guest on July-02-2021

Code answers related to "horizontal recyclerview item width half of screen android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language