KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been using a bit of a hack to stretch a view inside a parent RelativeLayout so that it starts at top-left and ends an bottom-center. While RelativeLayout does let you position something at the center of itself, it doesn't however seem to let you stretch something to that same point. My solution was simple, position something in that center, and give it 1px dimensions so its the actual center of the parent RelativeLayout . Don't get me wrong, this works and I've had no issues whatsoever with it, but if there's a better practice that this I'd like to know about it. As for a graphical representation of what I'm talking about, let me add a few images illustrating. This first image has a text-less TextView positioned at the center of the RelativeLayout and I've given it a width of 0dp. This allows me as you can see in the next image to place anything, relative to that center. My point being that it strikes me as odd that you can't do that without the need of adding the extra view at the center, for I can see properties such as Layout to left of or Layout to right of but no Layout to center of . So the scennario may be a bit more in the lines of, " it's not broken yet but I'm afraid it will pop at any minute ". Then on the other hand if this is the correct way of doing it and I help someone learning a new thing, that also works for me. Why do I ask questions that don't get answered!? I'm so setting a bounty here.. The most sensible thing suggested yet (to my judgement) is that I replace m
Tags (comma-separated)
Save Edits
Cancel