I have a custom component which consists of 2 text view and 4 toggle buttons. I want to draw this view at some specific position on the screen. How is that possible?
Share
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.
You could wrap the controls in a Layout, e.g. a LinearLayout, and add
android:paddingLeftandandroid:paddingTopby some pixel value to that Layout to position it how you want.However I would advise that Android Layouts are better designed with relative positions rather than absolute positions. Different devices have different screen sizes, and unless you prohibit it your layouts can be switched between Portrait to Landscape ratios without warning. Layouts designed with relative positioning hold up much better under these conditions. The RelativeLayout container allows tricks like centering controls on the screen, and aligning them relative to other controls.
http://developer.android.com/intl/de/reference/android/widget/RelativeLayout.html