how to define a static view?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

how to define a static view?

Postby gumatias » Tue Jan 26, 2010 7:55 pm

Hi guys,

I'm new to android and I'm having some issues trying to figure out how to have a header as a static view with an edit text and the rest of the layout can be either a dynamic ListView, ImageView or a view that contains an EditText.
I have no idea how to do that because when I try to extend a ListActivity to my class, I get an exception saying that I need to provide a ListView but I only want Lists to be shown when EditTexts or ImageViews are not on control.

Can anybody help me please???

Thanks in advance.
Junior Developer
Junior Developer
Posts: 14
Joined: Mon Nov 30, 2009 4:17 pm


Postby jwei512 » Wed Jan 27, 2010 12:05 am

Have you tried using a FrameLayout? When I did this in one of my apps that's what I used and it worked well. ... ayout.html

From the docs the important parts are:

FrameLayout is designed to block out an area on the screen to display a single item. You can add multiple children to a FrameLayout, but all children are pegged to the top left of the screen. Children are drawn in a stack, with the most recently added child on top

And so basically what you can do is add a ListView first and set a layout_marginTop = " x dip" where x is the height of the header, and then add the "static view" on top of that so that the list will scroll and get created dynamically without affecting the static header
- jwei
Examples, Code, and Tutorials
Senior Developer
Senior Developer
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 7 guests