Professional Documents
Culture Documents
Ms
Siguiente blog
Crear un blog
Acceder
VISITAS:
3 3 6 2 3
Sgueme por mail
Submit
abril (1)
febrero (1)
enero (4)
2011 (15)
2010 (5)
2009 (10)
Solucin
Seguidores
Participar en este sitio
Google Friend Connect
Miembros (7)
Datos personales
joseanquiles
Ver todo mi perfil
<LinearLayout xmlns:android="http://schemas.android.com/apk/res
/android" xmlns:tools="http://schemas.android.com
/tools" android:layout_width="match_parent" android:layout_height="mat
ch_parent" android:orientation="horizontal" android:padding="20dp">
<Button android:layout_height="wrap_content" android:layout_width="m
atch_parent" android:layout_weight="1" android:layout_margin="5dp" andr
oid:text="Botn 1" />
<Button android:layout_height="wrap_content" android:layout_width="m
atch_parent" android:layout_weight="1" android:layout_margin="5dp" andr
oid:text="Botn 2" />
<Button android:layout_height="wrap_content" android:layout_width="m
atch_parent" android:layout_weight="1" android:layout_margin="5dp" andr
oid:text="Botn 3" />
<Button android:layout_height="wrap_content" android:layout_width="m
atch_parent" android:layout_weight="1" android:layout_margin="5dp" andr
oid:text="Botn 4" />
</LinearLayout>
Explicacin
Con un LinearLayout horizontal ponemos los 4 botones en una fila.
El padding de 20dp en el LinearLayout pone un espacio interno para su
contenido (los botones).
Cada botn tiene un weight de 1 para que sean todos iguales dentro del
padre.
El margin de 5dp en los botones hace que stos queden separados entre s
por 5dp.
Ejercicio 2
Dividir la pantalla verticalmente en dos mitades. En la mitad superior
superior, colocar una imagen que ocupe toda la parte superior. En la mitad
inferior colocar un texto largo que permita desplazarse con scroll para
poder visualizarlo.Ambas mitades deben estar rodeadas de un margen de
5dp.
Solucin
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res
/android" xmlns:tools="http://schemas.android.com
/tools" android:layout_width="match_parent" android:layout_height="mat
ch_parent" android:orientation="vertical" android:padding="5dp">
<ImageView android:layout_width="match_parent" android:layout_height
="match_parent" android:scaleType="fitCenter" android:layout_weight="1"
android:src="@drawable/ic_launcher" />
<ScrollView android:layout_width="match_parent" android:layout_height
="match_parent" android:layout_weight="1">
<TextView android:layout_width="match_parent" android:layout_height
="wrap_content" android:text="@string/texto" />
</ScrollView>
</LinearLayout>
Ejercicio 3
Un botn que ocupe el 50% del ancho de la pantalla y que est centrado
vertical y horizontalmente en la pantalla.
Solucin
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res
/android" xmlns:tools="http://schemas.android.com
/tools" android:layout_width="match_parent" android:layout_height="mat
ch_parent" android:orientation="horizontal" android:gravity="center" andr
oid:weightSum="100">
<Button android:layout_width="0dp" android:layout_height="wrap_conte
nt" android:layout_weight="50" android:text="Botn" />
</LinearLayout>
Ejercicio 4
Construir el siguiente formulario:
Solucin
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res
/android" xmlns:tools="http://schemas.android.com
/tools" android:layout_width="match_parent" android:layout_height="mat
ch_parent" android:layout_marginTop="5dp" android:stretchColumns="1">
<TableRow>
<TextView android:text="Nombre (*)" android:layout_width="wrap_cont
ent" android:layout_height="wrap_content" />
<EditText android:layout_width="match_parent" android:layout_height=
"wrap_content" android:layout_margin="6dp" />
</TableRow>
<TableRow>
<TextView android:text="Apellido (*)" android:layout_width="wrap_cont
ent" android:layout_height="wrap_content" />
<EditText android:layout_width="match_parent" android:layout_height=
"wrap_content" android:layout_margin="6dp" />
</TableRow>
<TableRow>
<TextView android:text="e-mail (*)" android:layout_width="wrap_conte
nt" android:layout_height="wrap_content" />
No hay comentarios:
Comentar como:
Publicar
Seleccionar perfil...
Vista previa
Entrada ms reciente
Pgina principal
Entrada antigua