Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
    }
 
PREVIOUS NEXT
Tagged: #horizontal #recyclerview #item #width #screen #android
ADD COMMENT
Topic
Name
7+2 =