Answers for "android how to get layout params and set to other view programmatically"

0

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
Posted by: Guest on March-16-2020

Code answers related to "android how to get layout params and set to other view programmatically"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language