Public getItemViewType

Return getItemViewType

 

 

Public unregisterDataSetObserver

UnregisterDataSetObserver

 

 

Public areAllItemsEnabled

Return areAllItemsEnabled

 

 

Public isEnabled

Return isEnabled

 

 

We can then subclass to create , overriding the default but otherwise allowing the delegated to do the “real work:”

Public class extends

Null

Null

 

Public RateableWrapper

Super

 

This

This new getCount

 

For getCount

This

 

Public getView

 

Null

 

If null

New LinearLayout

New RatingBar

SetNumStars

SetStepSize

GetView null

SetOrientation

SetLayoutParams new LayoutParams

 

 

SetLayoutParams new LayoutParams

 

 

New OnRatingBarChangeListener

Public onRatingChanged

 

GetTag

 

SetOnRatingBarChangeListener

AddView

AddView

New ViewWrapper

SetGuts

SetTag

SetTag new Integer

SetRating

 

Else

GetTag

SetGuts getView getGuts

 

GetRatingBar setTag new Integer

GetRatingBar setRating

 

 

Return

 

 

The idea is that is where most of our rate‑list logic resides. It puts the rating bars on the rows and it tracks the rating bars’ states as they are adjusted by the user. For the states, it has a sized to fit the number of rows that the delegate says are in the list.

’s implementation of is reminiscent of the one from , except that rather than use , we need to manually construct a to hold our and the “guts” (that is, whatever view the delegate created that we are decorating with the checkbox). is designed to construct a from raw widgets; in our case, we don’t know in advance what the rows will look like, other than that we need to add a checkbox to them. However, the rest is similar to what we saw in :

Class

 

Null

Null

 








Дата добавления: 2015-05-16; просмотров: 746;


Поиск по сайту:

При помощи поиска вы сможете найти нужную вам информацию.

Поделитесь с друзьями:

Если вам перенёс пользу информационный материал, или помог в учебе – поделитесь этим сайтом с друзьями и знакомыми.
helpiks.org - Хелпикс.Орг - 2014-2024 год. Материал сайта представляется для ознакомительного и учебного использования. | Поддержка
Генерация страницы за: 0.005 сек.