Pages

Thursday, May 19, 2011

Android Layout Tutorial-AbsoluteLayout

AbsoluteLayout is based on the simple idea of placing each control at an absolute position.  You specify the exact x and y coordinates on the screen for each control.  This is not recommended for most UI development (in fact AbsoluteLayout is currently deprecated) since absolutely positioning every element on the screen makes an inflexible UI that is much more difficult to maintain.  Consider what happens if a control needs to be added to the UI. You would have to change the position of every single element that is shifted by the new control.
Here is a sample Layout XML using AbsoluteLayout.
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button 
     android:id="@+id/backbutton"
     android:text="Back"
     android:layout_x="10px"
     android:layout_y="5px"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />
    <TextView
     android:layout_x="10px"
     android:layout_y="110px"
     android:text="First Name"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />
    <EditText
     android:layout_x="150px"
     android:layout_y="100px"
     android:width="100px"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />
    <TextView
     android:layout_x="10px"
     android:layout_y="160px"
     android:text="Last Name"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />
     <EditText
     android:layout_x="150px"
     android:layout_y="150px"
     android:width="100px"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />
</AbsoluteLayout>
Note how each element has android:layout_x and android:layout_y specified. Android defines the top left of the screen as (0,0) so the layout_x value will move the control to the right, and the layout_y value will move the control down. Here is a screenshot of the layout produced by this XML.
AbsoluteLayout

39 comments:

  1. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    Devops Training in Chennai

    Devops Training in Bangalore

    Devops Training in pune

    Devops training in tambaram

    ReplyDelete
  2. Woah this blog is wonderful i like studying your posts. Keep up the great work! You understand, lots of persons are hunting around for this info, you could help them greatly.

    Blueprism training in Chennai

    Blueprism training in Bangalore

    ReplyDelete
  3. Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks

    Data Science training in kalyan nagar | Data Science training in OMR
    selenium training in chennai | Data Science training in chennai
    Data science training in velachery | Data science online training

    ReplyDelete
  4. The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    angularjs Training in bangalore

    angularjs Training in bangalore

    ReplyDelete
  5. Really great post, I simply unearthed your site and needed to say that I have truly appreciated perusing your blog entries. I want to say thanks for great sharing.

    Microsoft Azure online training
    Selenium online training
    Java online training
    Java Script online training
    Share Point online training

    ReplyDelete
  6. Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog..
    If you are looking for any python Related information please visit our website Python Training In Pune page!

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Data Science is the future of Artificial Intelligence. Therefore, it is very important to understand what is Data Science and how can it add value to your business.
    Best Institute for Data Science in Mumbai which includes classroom and online training. Along with Classroom training, we also conduct online training using state-of-the-art technologies to ensure the wonderful experience of online interactive learning. Best Institute for Data Science

    ReplyDelete
  9. Thanks for sharing,you gave a lot of useful information that i was exactly looking for.Its very interesting.Data Science is growing fast,if you are the one looking for Data Science certification course visitBest Data Science Certification Course in Bangalore

    ReplyDelete
  10. Do you want to get back love of your life and have tried all possible efforts but failed in all? Did you love someone madly but recently had a breakup? Do you want your beloved back? If yes then astrology is the best which recommends various remedies to solve this problem.

    Get your love back astrologer to see a wonderful difference created in your love life. Astrology will work like magic and at the end your love life will be blessed with happiness and passion for each other. Ask your World Famous Indian Astrologer now.

    ReplyDelete
  11. Such a very amazing post and helpful blog..
    Thanks for sharing with us,
    We are again come on your website,
    Thanks and good day,
    Please visit our site,
    buylogo

    ReplyDelete
  12. Your content is awesome.
    BEST ANGULAR JS TRAINING IN CHENNAI WITH PLACEMENT

    https://www.acte.in/angular-js-training-in-chennai
    https://www.acte.in/angular-js-training-in-annanagar
    https://www.acte.in/angular-js-training-in-omr
    https://www.acte.in/angular-js-training-in-porur
    https://www.acte.in/angular-js-training-in-tambaram
    https://www.acte.in/angular-js-training-in-velachery


    ReplyDelete
  13. Attend The Data Scientist Courses From ExcelR. Practical Data Scientist Courses Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Scientist Courses. Data Scientist Courses

    ReplyDelete
  14. It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
    data scientist training and placement in hyderabad

    ReplyDelete
  15. Buy a logo with 6O% Off,
    Perfect, best service I expect You'll satisfied with us.
    Custom Logo

    ReplyDelete
  16. HEY!
    Visit our site for many beautiful logo designs with 5O% off I expect You will be happy with us.Logo Designers

    ReplyDelete
  17. this is such a great blog I ever say thanks for sharing it with us...
    we surely can help you if you have an interest in web designing or logo designing then visit us?
    Logo Designers

    ReplyDelete
  18. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one
    data scientist training and placement

    ReplyDelete
  19. I am unquestionably making the most of your site. You unquestionably have some extraordinary knowledge and incredible stories.
    Data Science Training in Hyderabad
    Data Science Course in Hyderabad

    ReplyDelete
  20. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
    DevOps Training in Hyderabad
    DevOps Course in Hyderabad

    ReplyDelete
  21. Really awesome bog, informative blog and knowledgeable content. Thanks for sharing with us. If you want to become a data science expert, then check out the following link.
    Data Science Course with Placements in Hyderabad

    ReplyDelete
  22. Гадание онлайн три карты на ближайшее - это проверенный способ поворожить с применением разнообразных объектов и методов. Комплекс мероприятий, направленных на прогнозирование судьбы, называют хиромантия. Сверхъестественные силы и всевозможные варианты предсказания судьбы наукой не установлены, однако многие люди верят в это.

    ReplyDelete
  23. Imunify360 License stands as a robust security solution for Linux web servers, offering proactive defence against digital threats with its advanced firewall, malware scanning, and intrusion detection systems.

    ReplyDelete

Popular Posts