Android - How to place an item on a layout relatively to the top?
How could I proceed to place an item on a LinearLayout, with a given space from the top? For instance, I would like to pla开发者_Python百科ce the logo on the half of the top middle of the layout.
Thanks
There is no way to add percentages.
You can add two layouts with the same weight to split the screen in two and then add the logo with a centered gravity to the upper layout,
Or you can measure the screen and add the right amount of margins.
Use the paddingTop attribute of the view class.
精彩评论