新聞中心
BaseItemProvider

創(chuàng)新互聯(lián)是一家專注于做網(wǎng)站、網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),寧江網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十載,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:寧江等地區(qū)。寧江做網(wǎng)站價(jià)格咨詢:13518219792
java.lang.Object
|---ohos.agp.components.BaseItemProvider
public abstract class BaseItemProvider
extends Object提供 BaseItemProvider 對象以將 ComponentProvider 項(xiàng)與組件的基本數(shù)據(jù)相關(guān)聯(lián)。
提供者提供對數(shù)據(jù)項(xiàng)的訪問并為數(shù)據(jù)集中的每個(gè)項(xiàng)創(chuàng)建一個(gè)組件。 當(dāng)數(shù)據(jù)集中的內(nèi)容發(fā)生變化時(shí),通知訂閱者響應(yīng)變化,并在屏幕上同步刷新更新的內(nèi)容。
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| BaseItemProvider() | 構(gòu)造函數(shù) |
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| void | addDataSubscriber(DataSetSubscriber subscriber) | 添加數(shù)據(jù)集訂閱者。 |
| abstract Component | getComponent(int position, Component convertComponent, ComponentContainer parent) | 獲取在數(shù)據(jù)集中指定位置顯示數(shù)據(jù)的組件。 |
| int | getComponentTypeCount() | 獲取數(shù)據(jù)集中所有項(xiàng)目的組件類型數(shù)。 |
| abstract int | getCount() | 獲取提供程序中的數(shù)據(jù)項(xiàng)總數(shù)。 |
| TextFilter | getFilter() | 獲取文本過濾器。 |
| abstract Object | getItem(int position) | 獲取數(shù)據(jù)集中指定位置的數(shù)據(jù)項(xiàng)。 |
| int | getItemComponentType(int position) | 根據(jù)位置獲取數(shù)據(jù)集中數(shù)據(jù)項(xiàng)的組件類型。 |
| abstract long | getItemId(int position) | 獲取數(shù)據(jù)集中指定位置的數(shù)據(jù)項(xiàng)的行ID。 |
| void | notifyDataChanged() | 刷新已更新數(shù)據(jù)項(xiàng)的組件。 |
| void | notifyDataInvalidated() | 當(dāng)提供者數(shù)據(jù)無效時(shí)調(diào)用。 |
| void | notifyDataSetItemChanged(int position) | 刷新已更新數(shù)據(jù)項(xiàng)的組件。 |
| void | notifyDataSetItemInserted(int position) | 刷新指定數(shù)據(jù)項(xiàng)已更改的組件。 |
| void | notifyDataSetItemRangeChanged(int startPos, int countItems) | 刷新從給定位置開始的指定數(shù)量的數(shù)據(jù)項(xiàng)已更改的組件。 |
| void | notifyDataSetItemRangeInserted(int startPos, int countItems) | 刷新從給定位置開始插入了指定數(shù)量的數(shù)據(jù)項(xiàng)的組件。 |
| void | notifyDataSetItemRangeRemoved(int startPos, int countItems) | 刷新已刪除從給定位置開始的指定數(shù)量數(shù)據(jù)項(xiàng)的組件。 |
| void | notifyDataSetItemRemoved(int position) | 刷新已從中刪除指定數(shù)據(jù)項(xiàng)的組件。 |
| void | onItemMoved(int from, int to) | 當(dāng)組件項(xiàng)應(yīng)移動(dòng)到數(shù)據(jù)集中的其他位置時(shí)在內(nèi)部調(diào)用。 |
| void | removeDataSubscriber(DataSetSubscriber subscriber) | 刪除數(shù)據(jù)集訂閱者。 |
| void | setFilter(TextFilter filter) | 設(shè)置文本過濾器。 |
| 從類 java.lang.Object 繼承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
構(gòu)造函數(shù)相信信息
BaseItemProvider
public BaseItemProvider()
構(gòu)造函數(shù)
方法詳情
getCount
public abstract int getCount()
獲取提供程序中的數(shù)據(jù)項(xiàng)總數(shù)。
返回:
返回提供程序中的數(shù)據(jù)項(xiàng)總數(shù)。
getItem
public abstract Object getItem(int position)
獲取數(shù)據(jù)集中指定位置的數(shù)據(jù)項(xiàng)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 表示數(shù)據(jù)項(xiàng)在數(shù)據(jù)集中的位置。 |
返回:
返回指定位置的數(shù)據(jù)項(xiàng)。
getItemId
public abstract long getItemId(int position)
獲取數(shù)據(jù)集中指定位置的數(shù)據(jù)項(xiàng)的行ID。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 表示數(shù)據(jù)項(xiàng)的行ID的位置。 |
返回:
返回指定位置的數(shù)據(jù)項(xiàng)的行 ID。
getComponent
public abstract Component getComponent(int position, Component convertComponent, ComponentContainer parent)
獲取在數(shù)據(jù)集中指定位置顯示數(shù)據(jù)的組件。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 表示組件在數(shù)據(jù)集中的位置。 |
| convertComponent | 表示要重用的前一個(gè)組件。 如果沒有此類組件,則此參數(shù)可以為 null。 |
| parent | 表示與要獲取的組件匹配的父組件。 |
返回:
返回與指定位置的數(shù)據(jù)項(xiàng)匹配的組件。
getItemComponentType
public int getItemComponentType(int position)
根據(jù)位置獲取數(shù)據(jù)集中數(shù)據(jù)項(xiàng)的組件類型。
每次將組件布局添加到數(shù)據(jù)集時(shí),都必須添加組件類型以匹配組件布局。 組件類型取值范圍從 0 到 getComponentTypeCount() 的結(jié)果減 1。例如,包含一個(gè)鍵的組件布局匹配組件類型值 0,包含兩個(gè)鍵的組件布局匹配組件類型值 1。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 指示組件項(xiàng)在提供程序數(shù)據(jù)集中的位置。 |
返回:
返回組件類型。
getComponentTypeCount
public int getComponentTypeCount()
獲取數(shù)據(jù)集中所有項(xiàng)目的組件類型數(shù)。 默認(rèn)情況下,組件類型的數(shù)量為 1。
返回:
返回?cái)?shù)據(jù)集中所有項(xiàng)目的組件類型數(shù)。
notifyDataChanged
public void notifyDataChanged()
刷新已更新數(shù)據(jù)項(xiàng)的組件。
使用 DataSetPublisher#notifyChanged() 方法通知每個(gè)注冊的訂閱者。
notifyDataInvalidated
public void notifyDataInvalidated()
當(dāng)提供者數(shù)據(jù)無效時(shí)調(diào)用。
使用 DataSetPublisher#informInvalidated() 方法通知每個(gè)注冊的訂閱者。
notifyDataSetItemChanged
public void notifyDataSetItemChanged(int position)
刷新已更新數(shù)據(jù)項(xiàng)的組件。
使用 DataSetPublisher#notifyItemChanged(int) 方法通知每個(gè)注冊的訂閱者。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 表示項(xiàng)目在數(shù)據(jù)集中的位置。 |
notifyDataSetItemInserted
public void notifyDataSetItemInserted(int position)
刷新指定數(shù)據(jù)項(xiàng)已更改的組件。
要通知數(shù)據(jù)更改訂閱者,請調(diào)用 DataSetPublisher#notifyItemChanged(int)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 指示更改的數(shù)據(jù)項(xiàng)在數(shù)據(jù)集中的位置。 |
notifyDataSetItemRemoved
public void notifyDataSetItemRemoved(int position)
刷新已從中刪除指定數(shù)據(jù)項(xiàng)的組件。
要通知數(shù)據(jù)更改訂閱者,請調(diào)用 DataSetPublisher#notifyItemRemoved(int)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| position | 表示被移除的數(shù)據(jù)項(xiàng)在數(shù)據(jù)集中的位置。 |
notifyDataSetItemRangeChanged
public void notifyDataSetItemRangeChanged(int startPos, int countItems)
刷新從給定位置開始的指定數(shù)量的數(shù)據(jù)項(xiàng)已更改的組件。
要通知數(shù)據(jù)更改訂閱者,請調(diào)用 DataSetPublisher#notifyItemRangeChanged(int, int)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| startPos | 指示已更改的第一個(gè)數(shù)據(jù)項(xiàng)的位置。 |
| countItems | 指示已更改的數(shù)據(jù)項(xiàng)數(shù)。 |
notifyDataSetItemRangeInserted
public void notifyDataSetItemRangeInserted(int startPos, int countItems)
刷新從給定位置開始插入了指定數(shù)量的數(shù)據(jù)項(xiàng)的組件。
要通知數(shù)據(jù)更改訂閱者,請調(diào)用 DataSetPublisher#notifyItemRangeInserted(int, int)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| startPos | 指示已插入的第一個(gè)數(shù)據(jù)項(xiàng)的位置。 |
| countItems | 表示已插入的數(shù)據(jù)項(xiàng)數(shù)。 |
notifyDataSetItemRangeRemoved
public void notifyDataSetItemRangeRemoved(int startPos, int countItems)
刷新已刪除從給定位置開始的指定數(shù)量數(shù)據(jù)項(xiàng)的組件。
要通知數(shù)據(jù)更改訂閱者,請調(diào)用 DataSetPublisher#notifyItemRangeRemoved(int, int)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| startPos | 指示已刪除的第一個(gè)數(shù)據(jù)項(xiàng)的位置。 |
| countItems | 表示已刪除的數(shù)據(jù)項(xiàng)數(shù)。 |
addDataSubscriber
public final void addDataSubscriber(DataSetSubscriber subscriber)
添加數(shù)據(jù)集訂閱者。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| subscriber | 指示訂閱者在數(shù)據(jù)集中的內(nèi)容發(fā)生更改時(shí)通知。 |
removeDataSubscriber
public final void removeDataSubscriber(DataSetSubscriber subscriber)
刪除數(shù)據(jù)集訂閱者。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| subscriber | 指示訂閱者在數(shù)據(jù)集中的內(nèi)容發(fā)生更改時(shí)通知。 |
setFilter
public void setFilter(TextFilter filter)
設(shè)置文本過濾器。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| filter | 表示文本過濾器。 |
getFilter
public TextFilter getFilter()
獲取文本過濾器。
返回:
返回文本過濾器。
onItemMoved
public void onItemMoved(int from, int to)
當(dāng)組件項(xiàng)應(yīng)移動(dòng)到數(shù)據(jù)集中的其他位置時(shí)在內(nèi)部調(diào)用。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| from | 表示組件項(xiàng)在數(shù)據(jù)集中的原始位置。 |
| to | 表示組件項(xiàng)在數(shù)據(jù)集中的目標(biāo)位置。 |
網(wǎng)站題目:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSBaseItemProvider
文章起源:http://www.5511xx.com/article/coscdig.html


咨詢
建站咨詢
