how to set layout params in android programmatically
tv.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
how to set layout params in android programmatically
tv.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
how to set layout params in android programmatically
val parm : ViewGroup.LayoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)
binding!!.youtubePlayerView.layoutParams = parm
set view layout params android
yourView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
//change the parameters as whatever you want
));
//keep in mind that LinearLayout is not the only Layout, e.g. you can use ConstrainLayout etc...
//after, you need to add yourView to a layout as it won't redraw itself if you just change the layout parameters e.g.:
yourLayout.addView(yourView); //yourView will pop on yourLayout
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us