View setLayoutParams - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for View setLayoutParams method.

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:setId, setLayoutParams, setOrientation
        void setContentToFragment(T fragment) {
            if (fragment == null) {
                fragment = createFragment();
            } 
 
            LinearLayout layout = new LinearLayout(this);
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                    LinearLayout.LayoutParams.FILL_PARENT));
            layout.setId(FRAGMENT_ID);
 
            getSupportFragmentManager().beginTransaction() 
                    .add(FRAGMENT_ID, fragment)
                    .commit(); 
 
            fragmentId = FRAGMENT_ID;
 
            setContentView(layout);
        } 
 
9
CodeRank
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
This code example shows how to use the following methods:setLayoutParams, setTag, setNumStars, setOnRatingBarChangeListener, setRating
    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,
            LinearLayout.LayoutParams.FILL_PARENT));

9
CodeRank
This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, setLayoutParams, setOnKeyListener, getImeOptions
This code example shows how to use the following methods:setLayoutParams, setGravity, setText
         * number. 
         */ 
        @Override 
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            TextView tv = new TextView(getActivity());
            tv.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT,
                    MATCH_PARENT));
            tv.setText("Fragment #" + mNum);
            tv.setGravity(CENTER);
            return tv;
        } 
 
    } 
} 
9
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setIndeterminate, setVisibility
This code example shows how to use the following methods:getHolder, setLayoutParams
8
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setVisibility, addView, setGravity
8
CodeRank
This code example shows how to use the following methods:setLayoutParams, addView
  } 
 
  private View getWebView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    if ((row == null) || (row.findViewById(1337) == null)) {
      RelativeLayout layout = new RelativeLayout(activity);
      layout.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.FILL_PARENT, ListView.LayoutParams.WRAP_CONTENT));
      row = layout;
       
      WebView webView = new WebView(activity);
      webView.setId(1337);
      RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); 
      float scale = activity.getResources().getDisplayMetrics().density;
      boolean leftPadding = (parent.getTag().equals("right"));
      params.setMargins((int)(20 * scale) * (leftPadding ? 2 : 1), (int)(0 * scale), (int)(20 * scale), 0);
      webView.setLayoutParams(params);
      layout.addView(webView);
    } 
       
    WebView webView = (WebView)row.findViewById(1337);

8
CodeRank

Related View setLayoutParams Questions & Answers:

Other View setLayoutParams Examples

60:	
61:			imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
62:			imageView.setLayoutParams(new GridView.LayoutParams(imageWidth,
63:					imageWidth));
64:			imageView.setImageBitmap(image);

Read More

47:	        imageView.setImageResource(mThumbIds[position]);
48:	        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
49:	        imageView.setLayoutParams(new GridView.LayoutParams(70, 70));
50:	        return imageView;
51:		}

Read More

20:	        // Create a progress bar to display while the list loads
21:	        ProgressBar progressBar = new ProgressBar(this);
22:	        progressBar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
23:	                LayoutParams.WRAP_CONTENT, Gravity.CENTER));
24:	        progressBar.setIndeterminate(true);

Read More

23:	        if (convertView == null) {  // if it's not recycled, initialize some attributes
24:	            imageView = new ImageView(mContext);
25:	            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
26:	            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
27:	            imageView.setPadding(8, 8, 8, 8);

Read More

setLayoutParams Method Overview
Set the layout parameters associated with this view.
See Code Examples for other Android View Methods: