p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional Android 2 Application Development (http://p2p.wrox.com/book-professional-android-2-application-development-547/)
-   -   RelativeLayout vs. LinearLayout in Chapter 5 To-Do List-Example (http://p2p.wrox.com/book-professional-android-2-application-development/85053-relativelayout-vs-linearlayout-chapter-5-do-list-example.html)

tk1982k September 14th, 2011 09:57 PM

RelativeLayout vs. LinearLayout in Chapter 5 To-Do List-Example
 
Hi everyone,

since this is my first post here, so greetings to you (^-^)/
Please be kind since I'm still more or less an Android beginner.

While re-reading parts of the book, I stumbled over some strangeness I didn't realize the first time:

In Chapter 5, when the To-Do List example is customized with an Array Adapter (unfortunately there's no Listing number I can refer to... but it's the code two pages after Listing 5-24), the layout XML resource for the To-Do List items (todolist_item.xml) uses a RelativeLayout for grouping the two item's TextViews, but in the following ToDoItemAdapter's getView() method, a LinearLayout is used (either newly created and inflated, or cast from the the RelativeLayout argument).

It works both ways, and actually just the layout (i.e. how it looks) changes depending on whether a RelativeLayout or a LinearLayout is used - so I was wondering whether this code was somehow on purpose, or whether it was by mistake.

Greetings,

Ted

hdpavan August 1st, 2013 04:00 PM

Android Linear Layout scroll
 
Hi

Android linear layout, as the name suggests, all the elements(like textview , button ,) are displayed in a linear fashion, either Horizontally or Vertically and this behavior is set in android: orientation which is an attribute of the node Linear Layout. -

check this link where the linear layout is explained in detail <a href="http://www.pavanh.com/2012/09/android-linear-layout-with-example.html">Android Linear Layout</a>

hdpavan August 1st, 2013 04:01 PM

Android Linear Layout scroll
 
Hi

Android linear layout, as the name suggests, all the elements(like textview , button ,) are displayed in a linear fashion, either Horizontally or Vertically and this behavior is set in android: orientation which is an attribute of the node Linear Layout. -

check this link where the linear layout is explained in detail Android Linear Layout


All times are GMT -4. The time now is 10:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.