Commit e34dcd42 by 霍志良

feat:显示四个半item

parent 22deae9b
package com.yidianling.consultant.adapter
import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.ConsultantTopBannerBean
import kotlinx.android.synthetic.main.consultant_top_banner_item.view.*
......@@ -18,7 +17,7 @@ import kotlinx.android.synthetic.main.consultant_top_banner_item.view.*
*/
class ConsultantTopAdapter(
private val context: Context,
private val consultList: MutableList<ConsultantTopBannerBean>,
private val consultList: MutableList<ConsultantTopBannerBean>
) : RecyclerView.Adapter<ConsultantTopAdapter.ViewHolder>() {
override fun getItemCount(): Int = consultList.size
......@@ -30,6 +29,11 @@ class ConsultantTopAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val layoutParams = ViewGroup.LayoutParams(
(context.getResources().getDisplayMetrics().widthPixels / 4.5).toInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
)
holder.itemView.layoutParams = layoutParams
if (consultList[position].specialTopicSubhead?.isNotEmpty() == true) {
holder.consult_tag.visibility = View.VISIBLE
holder.consult_tag.text = consultList[position].specialTopicSubhead
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment