This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Android and the fly likes How to show a title to a ListView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to show a title to a ListView" Watch "How to show a title to a ListView" New topic
Author

How to show a title to a ListView

Claudinei Junior
Greenhorn

Joined: Feb 19, 2011
Posts: 14

Hello,

I'm trying to show a TextView in the top of a screen and, below the TextView, I want to show a ListView.

My layout is:


The only view that is being shown is the TextView. The ListView does not appear.

If I remove the TextView entry from the XML, the ListView appears.

Does anyone have an ideia of what I can do to show the TextView and the ListView?

Thanks in advance,
Best Regards
Anuj Prashar
Ranch Hand

Joined: Apr 15, 2008
Posts: 99

Just add this line in LinearLayout for orientation



After adding this line ListView will show along with TextView


SCJP 5,SCWCD 5, RHCT
Claudinei Junior
Greenhorn

Joined: Feb 19, 2011
Posts: 14

It worked!

Thanks a lot.

I'm just wondering why it worked - I mean: the vertical orientation is the "default" - why did I have to declare it explicity to work?

Thanks in advance,
Best Regards.
Anuj Prashar
Ranch Hand

Joined: Apr 15, 2008
Posts: 99


I'm just wondering why it worked - I mean: the vertical orientation is the "default" - why did I have to declare it explicity to work?


Default orientation is horizontal.

Check this link
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to show a title to a ListView
 
Similar Threads
How to capture the current screen from device
ListView Problem
Need Help on the scrolling Bar in Android?
How to add button at the end of the screen (after the ListView)
Layouts, bottom position