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?

---code---
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
   android:id="@+id/main"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent">
   <TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="@string/test" />
   <!-- Note built-in ids for 'list' and 'empty' -->
   <ListView
      android:id="@android:id/list"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
   <TextView
      android:id="@android:id/empty"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/empty" />
</LinearLayout>

--



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

Hi,
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?

Thanks,
Andrew

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(){
                @Override
                public boolean onTouch(View v, MotionEvent event){
                        if(mapOverlay.onTouchEvent(event, mapView)){
                                showDialog(DIALOG_ID);
                                mapView.invalidate();
                                return true;
                        }
                        return false;
                }
        };

        @Override
        protected void onCreate(Bundle savedInstanceState){
                super.onCreate(savedInstanceState);
                setContentView(R.layout.map);
                adapter = new Adapter(this);
                adapter.open();

                mapView = (MapView) findViewById(R.id.mapview);
                mapView.setSatellite(true);
                mapView.setStreetView(true);
                mapView.setBuiltInZoomControls(true);

                c = adapter.getAll();
                startManagingCursor(c);

                mapController = mapView.getController();

                mapOverlay = new MapOverlay(c);
                mapView.getOverlays().add(mapOverlay);

                mapView.setOnTouchListener(OTL);
                mapView.postInvalidate();

        }

--~--~---------~--~----~------------~-------~--~----~

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