Created
September 26, 2012 15:53
-
-
Save jheerman/3788834 to your computer and use it in GitHub Desktop.
M4A sample to center child view in relative layout
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
var viewContainer = new RelativeLayout(this); | |
var layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent); | |
AddContentView (viewContainer, layoutParams); | |
var btn = new Button(this) { Text = "Centered" }; | |
var btnParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); | |
btnParams.AddRule (LayoutRules.CenterInParent); | |
viewContainer.AddView (btn, btnParams); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment