Java Code Examples for android.widget.GridView#getChildAt()

The following examples show how to use android.widget.GridView#getChildAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdvancedActivity.java    From PkRequestManager with MIT License 6 votes vote down vote up
public void animateView(int position, GridView grid)
{
	try {
		View v = grid.getChildAt(position - grid.getFirstVisiblePosition());
	
		ViewHolder holder = new ViewHolder();
		holder.Card = (FrameLayout) v.findViewById(R.id.Card);
		holder.btnContainer = (FrameLayout) v.findViewById(R.id.btnIconContainer);
		holder.imgIcon = (ImageView) v.findViewById(R.id.imgIcon);
		holder.imgSelected = (ImageView) v.findViewById(R.id.imgSelected);
		holder.bgSelected = v.findViewById(R.id.bgSelected);
	
		if (this.mApps.get(position).isSelected())
			animateAppDeselected(holder);
		else
			animateAppSelected(holder);
	}
	catch(Exception e) {
		// View not visible
	}
}
 
Example 2
Source File: Helper.java    From AnimatedGridView with Apache License 2.0 5 votes vote down vote up
/**
 * HELPER METHODS!!
 */

public static View getViewByPosition(GridView gridView, int position) {
    int firstPosition = gridView.getFirstVisiblePosition();
    int lastPosition = gridView.getLastVisiblePosition();

    if ((position < firstPosition) || (position > lastPosition)) {
        return null;
    }

    return gridView.getChildAt(position - firstPosition);
}