Skip to content Skip to sidebar Skip to footer

Listview With The Fixed Number Of Items To Display

is there any standard way in Android for creating a list view covering content by width, but with the height big enough for displaying a fixed number of rows? For example, I would

Solution 1:

Try this.

adapter.setViewBinder(newSimpleAdapter.ViewBinder() {  
    publicbooleansetViewValue(View view, Object data, String textRepresentation) {  
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view
                .getLayoutParams();
        params.height = Math.round(mScreenHeight/ 6); 

        returntrue;  
        }  
    }  
);  

Solution 2:

The solution from wrap_content for a listview's width works ( see getWidestView ). Same thing can be applied for height ( measure a height using fake parent and *6 after )

Post a Comment for "Listview With The Fixed Number Of Items To Display"