Skip to content

Instantly share code, notes, and snippets.

@igordeoliveirasa
Created February 20, 2015 12:36
Show Gist options
  • Save igordeoliveirasa/74a4a9e0974981de52a5 to your computer and use it in GitHub Desktop.
Save igordeoliveirasa/74a4a9e0974981de52a5 to your computer and use it in GitHub Desktop.
Linear Layout Programmatically
LinearLayout linearLayout = new LinearLayout(context);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(context.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),0,0,0);
linearLayout.setLayoutParams(layoutParams);
linearLayout.setBackground(context.getResources().getDrawable(R.drawable.shape_rounded_background));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment