Android LinearLayout - 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 LinearLayout class.

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);
        } 
 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE

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

See Code Examples for Android LinearLayout Methods: