Created
March 31, 2022 18:24
-
-
Save smoralb/a64ec3c06e5a706b35f115c94a0f24a4 to your computer and use it in GitHub Desktop.
Creating a layout withint the need to create an XML file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState) | |
// creating LinearLayout | |
val linLayout: LinearLayout = LinearLayout(this) | |
// specifying vertical orientation | |
linLayout.setOrientation(LinearLayout.VERTICAL) | |
// creating LayoutParams | |
val linLayoutParam: LayoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | |
// set LinearLayout as a root element of the screen | |
setContentView(linLayout, linLayoutParam); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment