I came across a negative value assigned for an android button proerty as follows.
android:layout_marginTop="-37px"
Does anyone have any idea of what exactly this means…??? Thanks in advance…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A negative margin can be used to make a View appear smaller to the layout manager when it is been positioned.
So, for example imagine a View with a height of
hand a marginTop of-m. When this view is positioned, the manager will consider the top of the view to be-mrather the0. In a linear layout situation (assuming vertical layout), this would cause the view to be rendered on top of the previous view.You can see this in the example below, as you decrease the top margin of the textView2, it becomes overlaid on textView1.
Whether this is specified behaviour or not, I’m not 100% sure. In this post Romain Guy mentions that you can use negative margins, however in this post on Google Groups he mentioned that negative margins behaviour is unspecified.