本文整理匯總了Java中android.view.View.isActivated方法的典型用法代碼示例。如果您正苦於以下問題:Java View.isActivated方法的具體用法?Java View.isActivated怎麽用?Java View.isActivated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.isActivated方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDrawOver
import android.view.View; //導入方法依賴的package包/類
@Override public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
int childCount = parent.getChildCount();
if (childCount < 2) return;
RecyclerView.LayoutManager lm = parent.getLayoutManager();
float[] lines = new float[childCount * 4];
boolean hasDividers = false;
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
RecyclerView.ViewHolder viewHolder = parent.getChildViewHolder(child);
if (!(viewHolder instanceof ProgressBarViewHolder)) {
boolean canDivide = toDivide == null || viewHolder.getClass() == toDivide;
if (canDivide) {
int position = parent.getChildAdapterPosition(child);
if (child.isActivated() || (i + 1 < childCount && parent.getChildAt(i + 1).isActivated())) {
continue;
}
if (position != (state.getItemCount() - 1)) {
lines[i * 4] = inset == 0 ? inset : inset + lm.getDecoratedLeft(child);
lines[(i * 4) + 2] = lm.getDecoratedRight(child);
int y = lm.getDecoratedBottom(child) + (int) child.getTranslationY() - height;
lines[(i * 4) + 1] = y;
lines[(i * 4) + 3] = y;
hasDividers = true;
}
}
}
}
if (hasDividers) {
canvas.drawLines(lines, paint);
}
}