Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing ListView in home screen widget

How to make widget with something like ListView. I've made it using LinearLayout but I don't know how to discover amount of rows. (I want to know exact amount of rows to make widget able to paging)

I want it to look like this (photoshop and copypast):

enter image description here

Notes:

  1. Android 2.3.4 and below.
  2. widget of size 4x4

UPDATE AND CLARIFICATION:

When I said "scrollable" I mean scroll by click on UP and DOWN buttons (you see it on the screenshot) ie paging

like image 934
karabara Avatar asked May 03 '12 13:05

karabara


People also ask

What is setAdapter in android?

A list view is an adapter view that does not know the details, such as type and contents, of the views it contains. Instead list view requests views on demand from a ListAdapter as needed, such as to display new views as the user scrolls up or down. In order to display items in the list, call setAdapter(android.


1 Answers

I do not know how to determine real size the widget 4x4 in dp. It seems that it can be determined only by knowing the specific device.

You can scroll by fixed number of rows.

like image 191
Anton Avatar answered Oct 04 '22 04:10

Anton