Possible to display a string or button on top a listview?

by Mystique » Sun, 12 Sep 2010 14:42:44 GMT

Sponsored Links
 Hi, I can seems to get it write.
What is wrong with my layout?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
      android:text="@string/test" />
   <!-- Note built-in ids for 'list' and 'empty' -->
      android:text="@string/empty" />


Possible to display a string or button on top a listview?

by Dianne Hackborn » Sun, 12 Sep 2010 14:56:14 GMT

 You can't use wrap_content with a list view, because that will cause it to
expand to whatever size its full contents are.  If you want the list view to
expand to fill all space except the text views above and below, use
android:layout_height="0px" and android:layout_weight="1" on it.


Sponsored Links

Possible to display a string or button on top a listview?

by Mystique » Sun, 12 Sep 2010 15:31:11 GMT

 Hi, thanks for the advice.
Not sure what is wrong, I try putting android:layout_height="0px" and
android:layout_weight="1" but it still doesn't appear.

> >

Possible to display a string or button on top a listview?

by Dianne Hackborn » Sun, 12 Sep 2010 15:51:49 GMT

 Try using hierarchyviewer to see what is going on with your layout.

> > >

Other Threads

1. About TouchEvent..! in class Mapview or javascript

Hi! nice to meet you.

I'm developing Android. But I can't...

First, I wanna click on Google Map(in package MapView)
And  wanna get the value(GPoint)
But that have no Event Handler, So I think that use to JavaScript.

JavaScript can't call  the Package "http://maps.google.com/maps"
How can I this??

I wanna use to google map.
Describe to me.

First, Can I use EventHandler? Use to MapView...

Second, can I use "package googlemap" in JavaScript

please, Describe to me by be attached the code.


2. Launching a Dialog from Overlay/MapActivity

I've hit a wall on an app I'm writing. What the app does is it has a
list of locations that are marked on a Map through an Overlay. What I
want to do is make it so when the user clicks on a point, a dialog
will pop up giving some information that has been stored in a database
about that location. I have gotten this to work to some degree using
onTouchEvent in the Overlay (another class called MapOverlay) and an
OnTouchListener in the MapActivity. However, the problem is that once
I click to move the map around or bring up the zoom controls, it seems
like the OnTouchListener dies and does not get reactivated or that the
overrided method OnTouch in the OnTouchListener is never called again.
I can't do showDialog in an Overlay, and all attempts to launch a
Dialog through the MapOverlay have failed so far. Any suggestions?


Here is some of the code in the Map class (which extends MapActivity):
        private Cursor c;
        private MapController mapController;
        private MapView mapView;
        private MapOverlay mapOverlay
        OnTouchListener OTL = new OnTouchListener(){
                public boolean onTouch(View v, MotionEvent event){
                        if(mapOverlay.onTouchEvent(event, mapView)){
                                return true;
                        return false;

        protected void onCreate(Bundle savedInstanceState){
                adapter = new Adapter(this);

                mapView = (MapView) findViewById(R.id.mapview);

                c = adapter.getAll();

                mapController = mapView.getController();

                mapOverlay = new MapOverlay(c);




3. Webservices an Android.

4. Change Tab Widget icon for currently active tab

5. how to add other status to power-off menu

6. Viewing more details in list item using Listactivity and onListItemClick

7. ClassCastException if the same lib is used