Android ViewGroup - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ViewGroup class.

This code example shows how to use the following methods: setBackgroundColor, setLayoutParams, setVisibility, addView, addContentView
This code example shows how to use the following methods: setBackgroundColor, setLayoutParams, addView, setOrientation
        		ViewGroup.LayoutParams.FILL_PARENT, 0.0F);
          
        LinearLayout.LayoutParams webviewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
        		ViewGroup.LayoutParams.FILL_PARENT, 1.0F);
         
        root = new LinearLayout(this);
        root.setOrientation(LinearLayout.VERTICAL);
        root.setBackgroundColor(Color.BLACK);
        root.setLayoutParams(containerParams);
                 
        appView = new WebView(this);
        appView.setLayoutParams(webviewParams);
         
        WebViewReflect.checkCompatibility(); 
         
        /* This changes the setWebChromeClient to log alerts to LogCat!  Important for Javascript Debugging */        
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ECLAIR)
        	appView.setWebChromeClient(new EclairClient(this));        	
        else 
        	appView.setWebChromeClient(new GapClient(this));

9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: measure, setBackground, layout, draw, dispatchOnPreDraw
                    drawableResource.getResourceType() != ResourceType.DRAWABLE) {
                return Status.ERROR_NOT_A_DRAWABLE.createResult(); 
            } 
 
            // create a simple FrameLayout 
            FrameLayout content = new FrameLayout(context);
 
            // get the actual Drawable object to draw 
            Drawable d = ResourceHelper.getDrawable(drawableResource, context);
            content.setBackground(d);
 
            // set the AttachInfo on the root view. 
            AttachInfo_Accessor.setAttachInfo(content);
 
 
            // measure 
            int w = hardwareConfig.getScreenWidth();
            int h = hardwareConfig.getScreenHeight();
            int w_spec = MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY);
            int h_spec = MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY);

9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setTag, addView, setOrientation
                      ViewGroup parent) {
    ViewWrapper wrap=null;
    View row=convertView;
                             
    if (convertView==null) {
      LinearLayout layout=new LinearLayout(ctxt);
      RatingBar rate=new RatingBar(ctxt);
       
      rate.setNumStars(3);
      rate.setStepSize(1.0f);
       
      View guts=delegate.getView(position, null, parent);
     
      layout.setOrientation(LinearLayout.HORIZONTAL); 
           
      rate.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.FILL_PARENT));
      guts.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT,

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: addView, setOrientation, addView
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
        super.onCreate(savedInstanceState);
 
        LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
        mRootView = new ScrollView(this);
         
        EditText editText = new EditText(this);
        editText.requestFocus();
        mDefaultFocusedView = editText;
        layout.addView(editText);
 
        ((ScrollView) mRootView).addView(layout);
        setContentView(mRootView);
         
        // set to resize so IME is always shown (and also so 
        // ImfBaseTestCase#destructiveCheckImeInitialState thinks it should always be shown 
        this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setLayoutParams, setOnTouchListener, addView
This code example shows how to use the following methods: getMeasuredHeight, getMeasuredWidth, getVisibility, layout
		int parentTop = 0;
		int parentBottom = bottom - top;
 
		// imageView.layout(parentLeft, parentTop, imageView.getMeasuredWidth(), imageView.getMeasuredHeight()); 
		imageView.layout(parentLeft, parentTop, parentRight, parentBottom);
		if (enableZoomControls && zoomControls.getVisibility() == View.VISIBLE) {
			int zoomWidth = zoomControls.getMeasuredWidth();
			int zoomHeight = zoomControls.getMeasuredHeight();
			zoomControls.layout(parentRight - zoomWidth, parentBottom - zoomHeight, parentRight, parentBottom);
		} 
		 
		TiViewProxy viewProxy = (proxy == null ? null : proxy.get());
		TiUIHelper.firePostLayoutEvent(viewProxy);
	} 
 
	public void setColorFilter(ColorFilter filter)
	{ 
		imageView.setColorFilter(filter);
	} 
 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setBackgroundDrawable, addView, addView
        onTouchInterceptor = l;
    } 
 
    @Implementation 
    public void showAsDropDown(View anchor) {
        containerView = new LinearLayout(context);
        containerView.addView(contentView);
        containerView.setBackgroundDrawable(background);
        getWindowManager().addView(containerView, null);
    } 
 
    @Implementation 
    public void showAsDropDown(View anchor, int xoff, int yoff) {
        xOffset = xoff;
        yOffset = yoff;
        showAsDropDown(anchor);
    } 
 
    public boolean dispatchTouchEvent(MotionEvent e) {
        return onTouchInterceptor != null && onTouchInterceptor.onTouch(realPopupWindow.getContentView(), e);
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: requestLayout, addView, removeAllViews
		if (style != PLAIN && style != BIG && style != DARK && style != BIG_DARK) {
			Log.w(TAG, "Invalid value \"" + style + "\" for style.");
			return; 
		} 
 
		view.removeAllViews();
		progress = new ProgressBar(proxy.getActivity(), null, style);
		currentStyle = style;
		view.addView(progress);
		view.addView(label);
		view.requestLayout();
	} 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: addView, setOrientation
public class SmallCircleActivity extends Activity {
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        final LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
 
        View view = new PathView(this);
        layout.addView(view, new LinearLayout.LayoutParams(PathView.SIZE, PathView.SIZE));
        view = new PathView(this);
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        layout.addView(view, new LinearLayout.LayoutParams(PathView.SIZE, PathView.SIZE));
 
        setContentView(layout);
    } 
 
    static class PathView extends View {
        private static final int SIZE = 37;
        private final Paint mPaint;
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

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

See Code Examples for Android ViewGroup Methods: