Redimensionar un “LinearLayout” en Android

Un código sencillo y antes de que se me vaya a perder, les comparto la manera en la que pueden redimensionar un “LinearLayout”:

        final LinearLayout linearLayout = (LinearLayout) findViewById(R.id.sign_in_register);
        linearLayout.post(new Runnable() {
            public void run() {
                int layoutHeight = new Double(linearLayout.getHeight() * 0.7).intValue();
                android.widget.FrameLayout.LayoutParams linearLayoutParams = (android.widget.FrameLayout.LayoutParams)linearLayout.getLayoutParams();
                linearLayoutParams.height = layoutHeight;
                linearLayout.setLayoutParams(linearLayoutParams);
            }
        });

Analista/Desarrollador y cofundador de QBit Mexhico. Tecnologías utilizadas Android, Java (EJB, Servlets, Faces, Groovy & Grails, Maven, Swing), .Net (C#, VB, ASP, MVC), Delphi, Spring, Hibernate, DTSx, Oracle, T-SQL, Firebird, MySQL, MongoDB, NodeJs, ReactJs (Flux). Sistemas Operativos Mac, Ubuntu y Windows.

Twitter LinkedIn 

Compartir en...Tweet about this on TwitterPin on Pinterest0Share on LinkedIn0Share on Google+0Share on Facebook0