Android: Need help setting view alignment in code
I basically want to have several views aligned with each other using a relative layout. I can do so using xml, but unfortunately I can't find any documentation开发者_开发百科 that tells me what methods I need to call to get the same effect in code (All the examples and things just use xml). Since the imageviews are being made dynamically xml isn't an option for what I want to do. I've looked at layoutparameters which seems to let me change some options, but I'm not seeing a method that will let me change alignment relative to another view. Any help is appreciated.
After playing around with it some more found that addRule
is the method I need. Couldn't find it because I was looking for something with the term alignment in it.
Check out setLayoutParams
in the Android documentation:
https://developer.android.com/reference/android/view/View.html#setLayoutParams(android.view.ViewGroup.LayoutParams)
精彩评论