how to set layout params in android programmatically

// Create a new instance of the layout parameters
val layoutParams = ViewGroup.LayoutParams(
    ViewGroup.LayoutParams.MATCH_PARENT, // Width of the view
    ViewGroup.LayoutParams.WRAP_CONTENT  // Height of the view
)

// Set additional layout parameters if needed
layoutParams.marginStart = 16 // Start margin in pixels
layoutParams.marginEnd = 16   // End margin in pixels

// Apply the layout parameters to the view
yourView.layoutParams = layoutParams