How to use Android listview and ProgressBar (progress bar control)

Use of listview control: the listview control contains data row by row. There may be multiple columns in a row. If a row is selected, several columns of the row will be selected, and an event can be triggered. This control is still used a lot in peacetime. When using listview, you mainly need to set an adapter, which is mainly used to place some data. It is a little complicated to use. The simpleadapter provided by Android is used here in the following form: android.widget.simpleadapter.simpleadapter (context context, list <? Extends, map < string,? > > data, int resource, string [] from, int [] to). It can be seen that the second parameter of the function is a list, in which some hashmaps are stored, and hashmaps are maps, Key value pairs are placed inside; The third parameter is a layout file, that is, the layout of the adapter output; The fourth parameter is a character array, and the content of the array is the column name of each map column in the parameter list; The fifth parameter is an integer array, which means the format of the displayed value corresponding to the fourth parameter. It is generally a control. Because the third parameter is a layout file, we need to add a separate XML file in this project. At the same time, we should know that the listener for setting listview uses onlistitemclick() function. In addition, it should be noted that when defining array types in Java and initializing them, there is no equal sign in the middle, such as new string [] {"user_name", "user_birthday"}. This experiment refers to the materials of Mr. Mars. The display effect of listview is as follows:

Each time a row is selected, the position and ID of the row will be output in the background, and the three rows will be selected in turn

Background output is:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>