HowTo make ListView Larger so more than one item visible at a time ?

by Mark Murphy » Fri, 15 Jan 2010 07:22:00 GMT

Sponsored Links

Do not wrap a ListView in a ScrollView. ScrollView is for use with
widgets that do not know how to scroll; ListView already can scroll its
own contents.

Mark Murphy (a Commons Guy)  | 

_The Busy Coder's Guide to Android Development_ Version 2.8

Other Threads

1. List issues with Android devices here

Hi All,

I wanted to start this thread to list problems people have discovered
writing their apps on various devices.  There are so many devices that
Android runs on, and its getting harder to track down problems when
one particular device isn't performing as expected.  Hopefully this
will help save programmers time when they test out their code.  I'll
start this thread with my own contribution to the cause.  Please add
to this list.

HTC DESIRE HD - In the current devices
Camera.Parameters.getHorizontalViewAngle(), get.VerticalViewAngle(),
and .getFocalLength() report -1 instead of a real value form the
cameras lens.

MOTOROLA DROID - It doesn't seem possible to have a 'headless' Camera
preview.  In other words, being able to capture a camera preview
without the need for a dedicated surface as in
SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS.  It does work on current
Motorola devices and HTC devices like the TMobile G2.


2. Connecting 4 Geopoints

Hello All,

I am having 4 static Geopoints, I am able to mark them on the Map and also i
am able to draw line between them.

Now i am trying to animate the line while drawing between 2 Geopoints, i
just want to show them some kind of animation while drawing line .. is it
possible to do ?? or i can call some delay function ??

Please help me with this ..

My function

public class HelloMapView extends MapActivity {
    /** Called when the activity is first created. */
LinearLayout linearLayout;
MapView mapView;
    MapController mc;
    GeoPoint p,p1,p2,p3;

    class MapOverlay extends
        public boolean draw(Canvas canvas, MapView mapView,
        boolean shadow, long when)
            super.draw(canvas, mapView, shadow);

            //---translate the GeoPoint to screen pixels---
            Point screenPts = new Point();
            mapView.getProjection().toPixels(p, screenPts);

            //---add the marker---
            Bitmap bmp = BitmapFactory.decodeResource(
                getResources(), R.drawable.a);
            canvas.drawBitmap(bmp, screenPts.x, screenPts.y-35, null);

            //Coordinates 2

          //---translate the GeoPoint to screen pixels---
            Point screenPts1 = new Point();
            mapView.getProjection().toPixels(p1, screenPts1);

            //---add the marker---
            Bitmap bmp1 = BitmapFactory.decodeResource(
                getResources(), R.drawable.b);
            canvas.drawBitmap(bmp1, screenPts1.x, screenPts1.y-35, null);

            //Coordinates 3

           //---translate the GeoPoint to screen pixels---
            Point screenPts2 = new Point();
            mapView.getProjection().toPixels(p2, screenPts2);

            //---add the marker---
            Bitmap bmp2 = BitmapFactory.decodeResource(
                getResources(), R.drawable.c);
            canvas.drawBitmap(bmp2, screenPts2.x, screenPts2.y-35, null);

            //Coordinates 4

            //---translate the GeoPoint to screen pixels---
             Point screenPts3 = new Point();
             mapView.getProjection().toPixels(p3, screenPts3);

             //---add the marker---
             Bitmap bmp3 = BitmapFactory.decodeResource(
                 getResources(), R.drawable.dgreen);
             canvas.drawBitmap(bmp3, screenPts3.x, screenPts3.y-35, null);

            //----------- Start--------------//

            Paint mPaint = new Paint();
            super.draw(canvas, mapView, shadow);
            canvas.drawLine(screenPts.x, screenPts.y, screenPts1.x,
screenPts1.y, mPaint);
            canvas.drawLine(screenPts1.x, screenPts1.y, screenPts2.x,
screenPts2.y, mPaint);
            canvas.drawLine(screenPts2.x, screenPts2.y, screenPts3.x,
screenPts3.y, mPaint);
            return true;

    public void onCreate(Bundle savedInstanceState) {

        mapView = (MapView) findViewById(;


        mapView = (MapView) findViewById(;

        mc = mapView.getController();
        String coordinates[] = {"12.958998", "77.658998"};
        double lat = Double.parseDouble(coordinates[0]);
        double lng = Double.parseDouble(coordinates[1]);

        p = new GeoPoint(
            (int) (lat * 1E6),
            (int) (lng * 1E6));

        String coordinates1[] = {"12.95967","77.64918"};
        double lat1 = Double.parseDouble(coordinates1[0]);
        double lng1 = Double.parseDouble(coordinates1[1]);

        p1 = new GeoPoint(
            (int) (lat1 * 1E6),
            (int) (lng1 * 1E6));

        //For geopoint point 3

        String coordinates2[] = {"12.96052","77.64171"};
        double lat2 = Double.parseDouble(coordinates2[0]);
        double lng2 = Double.parseDouble(coordinates2[1]);

        p2 = new GeoPoint(
            (int) (lat2 * 1E6),
            (int) (lng2 * 1E6));

        //For geopoint point 4
        String coordinates3[] = {"12.96721","77.64141"};
        double lat3 = Double.parseDouble(coordinates3[0]);
        double lng3 = Double.parseDouble(coordinates3[1]);

        p3 = new GeoPoint(
            (int) (lat3 * 1E6),
            (int) (lng3 * 1E6));


      //---Add a location marker---
        MapOverlay mapOverlay = new MapOverlay();
        List<Overlay> listOfOverlays = mapView.getOverlays();



    protected boolean isRouteDisplayed() {
        return false;



3. Mixing RelativeLayout and Absolute

4. Audio capture issues

5. Calendar source code to eclipse

6. Dell Mini 10v

7. why is gingerbread unpopular?