“So setzen Sie Layoutparameter in Android programmatisch ein” Code-Antworten

So setzen Sie Layoutparameter in Android programmatisch ein

tv.setLayoutParams(new ViewGroup.LayoutParams(
    ViewGroup.LayoutParams.WRAP_CONTENT,
    ViewGroup.LayoutParams.WRAP_CONTENT));
android developer

So setzen Sie Layoutparameter in Android programmatisch ein

val parm : ViewGroup.LayoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)
binding!!.youtubePlayerView.layoutParams = parm
android developer

Setzen Sie Ansichtslayoutparameter 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
Fedeboss

Ähnliche Antworten wie “So setzen Sie Layoutparameter in Android programmatisch ein”

Fragen ähnlich wie “So setzen Sie Layoutparameter in Android programmatisch ein”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen