Best code examples for Android ViewGroup class (android.view.ViewGroup)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ViewGroup class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android ViewGroup examples from Open Source projects
Examples using Android ViewGroup addView method:
This code example shows how to use the following methods: addView, addContentView, setBackgroundColor, setLayoutParams, setVisibility
134:	mCustomViewContainer = new FrameLayout(activity); 
135:	mCustomViewContainer.setBackgroundColor(Color.BLACK); 
136:	mCustomViewContainer.setLayoutParams(params); 
137:	activity.getWindow().addContentView(mCustomViewContainer, params); 
-
139:	mCustomViewContainer.addView(view); 
-
142:	mCustomViewContainer.setVisibility(View.VISIBLE); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: addView, setOrientation, setBackgroundColor, setLayoutParams
78:	root = new LinearLayout(this); 
79:	root.setOrientation(LinearLayout.VERTICAL); 
80:	root.setBackgroundColor(Color.BLACK); 
81:	root.setLayoutParams(containerParams); 
-
111:	root.addView(appView); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: addView, setOrientation, setTag
50:	LinearLayout layout=new LinearLayout(ctxt); 
-
58:	layout.setOrientation(LinearLayout.HORIZONTAL); 
-
78:	layout.addView(rate); 
79:	layout.addView(guts); 
-
81:	wrap=new ViewWrapper(layout); 
-
83:	layout.setTag(wrap); 
Full Snippet Info
8
CodeRank
Examples using Android ViewGroup layout method:
This code example shows how to use the following methods: layout, draw, dispatchOnPreDraw, measure, setAttachInfo
76:	FrameLayout content = new FrameLayout(context); 
-
80:	content.setBackground(d); 
-
83:	AttachInfo_Accessor.setAttachInfo(content); 
-
91:	content.measure(w_spec, h_spec); 
-
94:	content.layout(0, 0, w, h); 
-
97:	AttachInfo_Accessor.dispatchOnPreDraw(content); 
-
111:	content.draw(canvas); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: layout, getMeasuredHeight, getMeasuredWidth, getVisibility
400:	if (enableZoomControls && zoomControls.getVisibility() == View.VISIBLE) { 
401:	int zoomWidth = zoomControls.getMeasuredWidth(); 
402:	int zoomHeight = zoomControls.getMeasuredHeight(); 
403:	zoomControls.layout(parentRight - zoomWidth, parentBottom - zoomHeight, parentRight, parentBottom); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: layout, draw, dispatchOnPreDraw, measure, setAttachInfo
74:	FrameLayout content = new FrameLayout(context); 
-
78:	content.setBackgroundDrawable(d); 
-
81:	AttachInfo_Accessor.setAttachInfo(content); 
-
89:	content.measure(w_spec, h_spec); 
-
92:	content.layout(0, 0, w, h); 
-
95:	AttachInfo_Accessor.dispatchOnPreDraw(content); 
-
109:	content.draw(canvas); 
Full Snippet Info
8
CodeRank
Examples using Android ViewGroup removeAllViews method:
This code example shows how to use the following methods: addView, removeAllViews, requestLayout
150:	view.removeAllViews(); 
-
153:	view.addView(progress); 
154:	view.addView(label); 
155:	view.requestLayout(); 
Full Snippet Info
8
CodeRank
Examples using Android ViewGroup removeView method:
This code example shows how to use the following methods: removeView, getParent
92:	ViewParent newEmptyViewParent = newEmptyView.getParent(); 
-
95:	((ViewGroup) newEmptyViewParent).removeView(newEmptyView); 
-
105:	.setEmptyViewInternal(newEmptyView); 
-
107:	this.mRefreshableView.setEmptyView(newEmptyView); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: removeView, getParent
91:	ViewParent newEmptyViewParent = newEmptyView.getParent(); 
-
94:	((ViewGroup) newEmptyViewParent).removeView(newEmptyView); 
-
104:	.setEmptyViewInternal(newEmptyView); 
-
106:	this.mRefreshableView.setEmptyView(newEmptyView); 
Full Snippet Info
8
CodeRank
Examples using Android ViewGroup getChildAt method:
This code example shows how to use the following methods: getChildAt, getHeaderViewsCount, getContext, getFirstVisiblePosition
37:	View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() 
38:	- mListView.getFirstVisiblePosition()); 
-
50:	ImageView iv = new ImageView(mListView.getContext()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getChildAt, getChildCount, getMaxScrollAmount, getCount, getVerticalFadingEdgeLength
44:	assertEquals("list item count", 5, mListView.getCount()); 
45:	assertEquals("list visible child count", 3, mListView.getChildCount()); 
46:	int firstTwoHeight = mListView.getChildAt(0).getHeight() + mListView.getChildAt(1).getHeight(); 
-
48:	firstTwoHeight <= mListView.getVerticalFadingEdgeLength()); 
-
50:	firstTwoHeight <= mListView.getMaxScrollAmount()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getChildAt, getAdapter, performItemClick
53:	long itemId = listView.getAdapter().getItemId(TESTED_CLICKED_INDEX); 
54:	View view = listView.getChildAt(TESTED_CLICKED_INDEX); 
-
57:	listView.performItemClick(view, TESTED_CLICKED_INDEX, itemId); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: clearDisappearingChildren, clearFocus, clearCache, clearFormData, clearHistory
41:	webView.clearCache(true); 
42:	webView.clearHistory(); 
43:	webView.clearView(); 
44:	webView.clearSslPreferences(); 
45:	webView.clearDisappearingChildren(); 
46:	webView.clearFocus(); 
47:	webView.clearFormData(); 
48:	webView.clearMatches(); 
Full Snippet Info
7
CodeRank
Examples for other Android ViewGroup methods:
Related Android ViewGroup Questions & Answers:
Other Android ViewGroup Examples
64:	        // Dropped, reassign View to ViewGroup
65:	        View view = (View) event.getLocalState();
66:	        ViewGroup owner = (ViewGroup) view.getParent();
67:	        owner.removeView(view);
68:	        LinearLayout container = (LinearLayout) v;
-
64:	        // Dropped, reassign View to ViewGroup
65:	        View view = (View) event.getLocalState();
66:	        ViewGroup owner = (ViewGroup) view.getParent();
67:	        owner.removeView(view);
68:	        LinearLayout container = (LinearLayout) v;

Read More

10:	
11:		@Override
12:		public View onCreateView(LayoutInflater inflater, ViewGroup container,
13:				Bundle savedInstanceState) {
14:

Read More

10:	
11:		@Override
12:		public View onCreateView(LayoutInflater inflater, ViewGroup container,
13:				Bundle savedInstanceState) {
14:

Read More

10:	
11:		@Override
12:		public View onCreateView(LayoutInflater inflater, ViewGroup container,
13:				Bundle savedInstanceState) {
14:

Read More

1:	public View onCreateView(LayoutInflater inflater, ViewGroup container,
2:	        Bundle savedInstanceState) {
3:	    ...

Read More

19:	
20:	    // create a new ImageView for each item referenced by the Adapter
21:	    public View getView(int position, View convertView, ViewGroup parent) {
22:	        ImageView imageView;
23:	        if (convertView == null) {  // if it's not recycled, initialize some attributes

Read More

26:	
27:	        // Must add the progress bar to the root of the layout
28:	        ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
29:	        root.addView(progressBar);
30:	
-
26:	
27:	        // Must add the progress bar to the root of the layout
28:	        ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
29:	        root.addView(progressBar);
30:

Read More

ViewGroup Class Overview
A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers. This class also defines the ViewGroup.LayoutParams class which serves as the base class for layouts parameters. Also see ViewGroup.LayoutParams for layout attributes. Here is a complete implementation of a custom ViewGroup that implements a simple FrameLayout along with the ability to stack children in left and right gutters.If you are implementing XML layout attributes as shown in the example, this is the corresponding definition for them that would go in res/values/attrs.xml:Fina...
Methods
  • addView
    Adds a child view with the specified layout parameters.
  • clearFocus
    Called when this view wants to give up focus.
  • getChildAt
    Returns the view at the specified position in the group.
  • hasFocus
    Returns true if this view has or contains focus
  • indexOfChild
    Returns the position in the group of the specified child view.
  • layout
    Assign a size and position to a view and all of its descendants This is the second phase of the layout mechanism.
  • removeAllViews
    Call this method to remove all child views from the ViewGroup.
  • removeAllViewsInLayout
    Called by a ViewGroup subclass to remove child views from itself, when it must first know its size on screen before it can calculate how many child views it will render.
  • removeView
    Note: do not invoke this method from draw(android.graphics.Canvas), onDraw(android.graphics.Canvas), dispatchDraw(android.graphics.Canvas) or any related method.
  • removeViewAt
    Removes the view at the specified position in the group.
  • removeViews
    Removes the specified range of views from the group.
  • setLayoutAnimation
    Sets the layout animation controller used to animate the group's children after the first layout.