Android examples for User Interface:View Property
get Next Sibling View
//package com.java2s; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; public class Main { public static View getNextSibling(View v) { ViewParent parent = v.getParent(); if (parent == null || !(parent instanceof ViewGroup)) return null; ViewGroup group = (ViewGroup) parent; int indexNext = group.indexOfChild(v) + 1; if (indexNext >= group.getChildCount()) return null; return group.getChildAt(indexNext); }/* www . j a v a 2 s . co m*/ public static <T extends ViewGroup> T getParent(View v) { ViewParent parent = v.getParent(); if (parent == null || !(parent instanceof ViewGroup)) return null; return (T) parent; } }