本文整理汇总了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);
}
}