Best code examples for Android LinearLayout class (android.widget.LinearLayout)

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

Android LinearLayout examples from Open Source projects
Examples using Android LinearLayout setOrientation method:
This code example shows how to use the following methods: setOrientation, setId, setLayoutParams
61:	LinearLayout layout = new LinearLayout(this); 
62:	layout.setOrientation(LinearLayout.VERTICAL); 
63:	layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 
-
65:	layout.setId(FRAGMENT_ID); 
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 LinearLayout setGravity method:
This code example shows how to use the following methods: addView, setGravity, setId, setLayoutParams, setVisibility
81:	mFooterView = new LinearLayout(context); 
82:	mFooterView.setId(INTERNAL_FOOTER_ID); 
83:	mFooterView.setGravity(Gravity.CENTER); 
84:	mFooterView.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); 
-
93:	mFooterView.addView(mProgress); 
-
102:	mFooterView.addView(mStandardEmptyView, new LayoutParams(MATCH_PARENT, MATCH_PARENT)); 
-
195:	mFooterView.setVisibility(View.VISIBLE); 
-
197:	mFooterView.setVisibility(View.GONE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addView, setGravity, setOrientation, setBackgroundResource, setLayoutParams
100:	LinearLayout linearLayout = new LinearLayout(context); 
101:	linearLayout.setOrientation(LinearLayout.HORIZONTAL); 
102:	linearLayout.setGravity(Gravity.CENTER); 
-
106:	linearLayout.setLayoutParams(lParams); 
107:	linearLayout.addView(textView); 
-
109:	linearLayout.setBackgroundResource(bgres); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, getContext, setBackgroundDrawable, setPadding
246:	Theme theme = ThemeUtil.createTheme(llProfileHeader.getContext()); 
247:	llProfileHeader.setBackgroundDrawable(theme.getDrawable("selector_bg_profile_header")); 
-
249:	llProfileHeader.setPadding(padding8, padding8, padding8, padding8); 
250:	llProfileHeader.setGravity(Gravity.CENTER); 
Full Snippet Info
7
CodeRank
Examples using Android LinearLayout getOrientation method:
This code example shows how to use the following methods: getOrientation, setOrientation
42:	assertThat(linearLayout.getOrientation()).isEqualTo(LinearLayout.HORIZONTAL); 
43:	linearLayout.setOrientation(LinearLayout.VERTICAL); 
44:	assertThat(linearLayout.getOrientation()).isEqualTo(LinearLayout.VERTICAL); 
45:	linearLayout.setOrientation(LinearLayout.HORIZONTAL); 
46:	assertThat(linearLayout.getOrientation()).isEqualTo(LinearLayout.HORIZONTAL); 
Full Snippet Info
8
CodeRank
Related Android LinearLayout Questions & Answers:
Other Android LinearLayout Examples
66:	        ViewGroup owner = (ViewGroup) view.getParent();
67:	        owner.removeView(view);
68:	        LinearLayout container = (LinearLayout) v;
69:	        container.addView(view);
70:	        view.setVisibility(View.VISIBLE);
-
66:	        ViewGroup owner = (ViewGroup) view.getParent();
67:	        owner.removeView(view);
68:	        LinearLayout container = (LinearLayout) v;
69:	        container.addView(view);
70:	        view.setVisibility(View.VISIBLE);

Read More

10:	public class MainActivity extends Activity {
11:	
12:		LinearLayout llStats;
13:		TextView txtPlayCount, txtEarned;
14:	
-
18:			setContentView(R.layout.activity_main);
19:	
20:			llStats = (LinearLayout) findViewById(R.id.llStats);
21:			txtPlayCount = (TextView) findViewById(R.id.txtNowPlaying);
22:			txtEarned = (TextView) findViewById(R.id.txtEarned);

Read More

36:		private ImageView imgProfilePic;
37:		private TextView txtName, txtEmail;
38:		private LinearLayout llProfileLayout;
39:	
40:		@Override
-
49:			txtName = (TextView) findViewById(R.id.txtName);
50:			txtEmail = (TextView) findViewById(R.id.txtEmail);
51:			llProfileLayout = (LinearLayout) findViewById(R.id.llProfile);
52:	
53:			// Button click listeners

Read More

57:		private ImageView imgProfilePic;
58:		private TextView txtName, txtEmail;
59:		private LinearLayout llProfileLayout;
60:	
61:		@Override
-
70:			txtName = (TextView) findViewById(R.id.txtName);
71:			txtEmail = (TextView) findViewById(R.id.txtEmail);
72:			llProfileLayout = (LinearLayout) findViewById(R.id.llProfile);
73:	
74:			// Button click listeners

Read More

LinearLayout Class Overview
A Layout that arranges its children in a single column or a single row. The direction of the row can be set by calling setOrientation(). You can also specify gravity, which specifies the alignment of all the child elements by calling setGravity() or specify that specific children grow to fill up any remaining space in the layout by setting the weight member of LinearLayout.LayoutParams. The default orientation is horizontal.

See the Linear Layout guide. Also see andr...
Methods
  • setGravity
    Describes how the child views are positioned.