View Single Post
  #1 (permalink)  
Old September 14th, 2011, 10:57 PM
tk1982k tk1982k is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote