本文整理汇总了Java中android.view.ViewGroup.getVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.getVisibility方法的具体用法?Java ViewGroup.getVisibility怎么用?Java ViewGroup.getVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.getVisibility方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidateDisplayListInt
import android.view.ViewGroup; //导入方法依赖的package包/类
private void invalidateDisplayListInt(ViewGroup viewGroup, boolean invalidateThis) {
for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
final View view = viewGroup.getChildAt(i);
if (view instanceof ViewGroup) {
invalidateDisplayListInt((ViewGroup) view, true);
}
}
if (!invalidateThis) {
return;
}
// we need to force it to become invisible
if (viewGroup.getVisibility() == View.INVISIBLE) {
viewGroup.setVisibility(View.VISIBLE);
viewGroup.setVisibility(View.INVISIBLE);
} else {
final int visibility = viewGroup.getVisibility();
viewGroup.setVisibility(View.INVISIBLE);
viewGroup.setVisibility(visibility);
}
}
示例2: invalidateDisplayListInt
import android.view.ViewGroup; //导入方法依赖的package包/类
private void invalidateDisplayListInt(ViewGroup viewGroup, boolean invalidateThis) {
for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
View view = viewGroup.getChildAt(i);
if (view instanceof ViewGroup) {
invalidateDisplayListInt((ViewGroup) view, true);
}
}
if (!invalidateThis) {
return;
}
if (viewGroup.getVisibility() == 4) {
viewGroup.setVisibility(0);
viewGroup.setVisibility(4);
return;
}
int visibility = viewGroup.getVisibility();
viewGroup.setVisibility(4);
viewGroup.setVisibility(visibility);
}
示例3: findCanScrollView
import android.view.ViewGroup; //导入方法依赖的package包/类
private View findCanScrollView(View v) {
if (v instanceof ViewGroup) {
ViewGroup target = (ViewGroup) v;
if ((target instanceof UltraViewPager || target instanceof RecyclerView)
&& target.getVisibility() == View.VISIBLE) {
return target;
} else {
for (int i = 0; i < target.getChildCount(); ++i) {
View view = findCanScrollView(target.getChildAt(i));
if (view != null) {
return view;
}
}
return null;
}
} else {
return null;
}
}
示例4: filterViewGroup
import android.view.ViewGroup; //导入方法依赖的package包/类
void filterViewGroup(MotionEvent ev) {
int downX = Math.round(ev.getX());
int downY = Math.round(ev.getY());
int size = mChildViewGroups.size();
mInAreaViewGroups.clear();
for (int i = 0; i < size; i++) {
ViewGroup child = mChildViewGroups.get(i);
if (child == null || child.getVisibility() == View.GONE)
continue;
if (downX > child.getLeft() && downX < child.getRight() && downY > child.getTop() && downY < child.getBottom())
mInAreaViewGroups.add(child);
}
}
示例5: canScrollUp
import android.view.ViewGroup; //导入方法依赖的package包/类
boolean canScrollUp() {
int size = mInAreaViewGroups.size();
for (int i = 0; i < size; i++) {
ViewGroup viewGroup = mInAreaViewGroups.get(i);
if (viewGroup != null && viewGroup.isEnabled() && viewGroup.getVisibility() != GONE) {
if (viewGroup instanceof RecyclerView
|| viewGroup instanceof AbsListView
|| viewGroup instanceof ScrollView)
return ViewCompat.canScrollVertically(viewGroup, -1);
}
}
return mRootView == null || ViewCompat.canScrollVertically(mRootView, -1);
}
示例6: isViewCovered
import android.view.ViewGroup; //导入方法依赖的package包/类
public static boolean isViewCovered(final View view) {
View currentView = view;
Rect currentViewRect = new Rect();
boolean partVisible = currentView.getGlobalVisibleRect(currentViewRect);
boolean totalHeightVisible = (currentViewRect.bottom - currentViewRect.top) >= view.getMeasuredHeight();
boolean totalWidthVisible = (currentViewRect.right - currentViewRect.left) >= view.getMeasuredWidth();
boolean totalViewVisible = partVisible && totalHeightVisible && totalWidthVisible;
if (!totalViewVisible)
return true;
while (currentView.getParent() instanceof ViewGroup) {
ViewGroup currentParent = (ViewGroup) currentView.getParent();
if (currentParent.getVisibility() != View.VISIBLE)
return true;
int start = indexOfViewInParent(currentView, currentParent);
for (int i = start + 1; i < currentParent.getChildCount(); i++) {
Rect viewRect = new Rect();
view.getGlobalVisibleRect(viewRect);
View otherView = currentParent.getChildAt(i);
Rect otherViewRect = new Rect();
otherView.getGlobalVisibleRect(otherViewRect);
if (Rect.intersects(viewRect, otherViewRect))
return true;
}
currentView = currentParent;
}
return false;
}
示例7: onSingleTapUp
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public boolean onSingleTapUp(MotionEvent e) {
int position = mDecor.findHeaderPositionUnder((int) e.getX(), (int) e.getY());
if (position != -1) {
ViewGroup headerView = (ViewGroup) mDecor.getHeaderCell(mRecyclerView, position).itemView;
mRecyclerView.playSoundEffect(SoundEffectConstants.CLICK);
headerView.onTouchEvent(e);
if (headerView.getVisibility() == View.VISIBLE) {
viewClick(headerView, e);
return true;
}
}
return false;
}