SlideShare a Scribd company logo
1 of 25
PORTAFOLIO
PARCIAL II
JOSÉ RODRIGO QUINTERO VALDEZ 4.-”G”
PRACTICA I
 EJERCICIO 1: LISTA DE INVITADOS
 EJERCICIO 2: LISTA DE INVITADOS EN PANTALLA COMPLETA
 EJERCICIO 3: INSERTAR UNA IMAGEN
 EJERCICIO 4: RELATIVE LAYOUT
 EJERCICIO 5: RELATIVE LAYOUT EN OBJETOS
 EJERCICIO 6: MARGENES
EJERCICIO 1: LISTA DE INVITADOS
 <LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/androi
d"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@android:color/darker_gray" >
 <TextView
 android:text="Lista de Invitados"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:background="#4CAF50"
 android:textSize="24sp" />
 <TextView
 android:text="Oswaldo"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:background="#4CAF50"
 android:textSize="24sp" />
 <TextView
 android:text="Axel"
 android:layout_width="wrap_content"
 android:layout_height="50dp"
 android:background="#4CAF50"
 android:textSize="24sp" />
 <TextView
 android:text="Elian"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:background="#4CAF50"
 android:textSize="24sp" />
 </LinearLayout>
Conclusión:
Iniciamos con un programa para
experimentar con el LinearLayout de
manera sencilla. Fue un programa fácil y
sin una interface complicada.
EJERCICIO 2: LISTA DE INVITADOS EN
PANTALLA COMPLETA
 <LinearLayout

xmlns:android="http://schemas.android.com/ap
k/res/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent"

android:background="@android:color/darker_gr
ay" >
 <TextView
 android:text="Lista de Invitados"
 android:layout_width="match_parent"
 android:layout_weight="1"
 android:background="#4CAF50"
 android:textSize="24sp" />
 <TextView
 android:text="Oswaldo"
 android:layout_width="match_parent"
 android:layout_weight="1"
 android:background="#4CAF50"
 android:textSize="24sp" />
 <TextView
 android:text="Axel“
 android:layout_width="match_parent“
 android:layout_weight="1"
 android:background="#4CAF50"
 android:textSize="24sp" />
 <TextView
 android:text="Elian"
 android:layout_width="match_parent"
 android:layout_weight="1"
 android:background="#4CAF50"
 android:textSize="24sp" />
 </LinearLayout>
Conclusión:
Programa que tiene contacto con
LinearLayout, al igual con las
divisiones de pantalla, que a través
de un comando
(android:layout_weight="1“)
Tiene una proporción que se adapta
a la pantalla.
EJERCICIO 3: INSERTAR UNA IMAGEN
 <LinearLayout

xmlns:android="http://schemas.android.com/a
pk/res/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent"

android:background="@android:color/darker_g
ray">
 <ImageView
 android:layout_width="wrap_content"
 android:layout_height="345dp"
 android:layout_weight="1"
 android:scaleType="centerCrop"
 android:src="@drawable/sergio2" />
 <TextView
 android:text="You're invited!"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_weight="1"
 android:textColor="@android:color/white"
 android:background="#009688"
 android:textSize="54sp" />
 <TextView
 android:layout_height="wrap_content"
 android:layout_weight="1"
 android:layout_width="match_parent"
 android:background="#009688"
 android:text="Bonfire at the beach"
 android:textColor="@android:color/white"
 android:textSize="34sp" />
 </LinearLayout>
Conclusión:
Programa que tiene contacto con LinearLayout,
al igual que insertar imágenes a la aplicación,
que se debe pegar en la carpeta “Drawable” del
proyecto en función y llamarse por la siguiente
línea de código
“android:src="@drawable/sergio2“”.
EJERCICIO 4: RELATIVE LAYOUT
 <RelativeLayout

xmlns:android="http://schemas.android.com/apk/
res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:padding="16dp" >
 <TextView
 android:text="I'm in this corner"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:layout_alignParentLeft="true" />
 <TextView
 android:text="Wait, I'm here"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentTop="true"
 android:layout_alignParentLeft="true" />
 <TextView
 android:text="Wait, I'm here"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:layout_alignParentRight="true" />
 <TextView
 android:text="Actually, I'm here"
 android:layout_height="wrap_content"
 android:layout_width="wrap_content"
 android:layout_alignParentTop="true"
 android:layout_alignParentRight="true" />
 </RelativeLayout>
Conclusión:
Programa que tiene contacto con RelativeLayout,
que nos permite alinear con respecto al área que
corresponde al RelativeLayout los objeto con el
siguiente código:
android:layout_alignParentTop="true“, el “Align”
puede alinear con otro comando.
EJERCICIO 5: RELATIVE LAYOUT EN
OBJETOS
 <RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent" >
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@android:color/holo_orange_dark"
 android:backgroundTint="@android:color/holo_orange_dark">
 <TextView
 android:id="@+id/lyla_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:layout_alingParentLeft="true"
 android:text="Lyla"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/me_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:layout_toRightOf="@id/lyla_text_view"
 android:text="Me"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/natalie_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="Natalie"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/jennie_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:layout_alignParentRight="true"
 android:text="Jennie"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/kunal_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentTop="true"
 android:layout_centerHorizontal="true"
 android:text="kunal"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/ben_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentTop="true"
 android:layout_toRightOf="@id/kunal_text_view"
 android:text="Ben"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/Amy_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:layout_toLeftOf="@id/jennie_text_view"
 android:text="Amy"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/Omoju_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_above="@+id/jennie_text_view"
 android:layout_alignParentEnd="true"
 android:layout_alignParentRight="true"
 android:text="Omoju"
 android:textSize="24sp" />
 <TextView
 android:id="@+id/Kagure_text_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentRight="true"
 android:layout_alignParentTop="true"
 android:text="Kagure"
 android:textSize="24sp" />
 </RelativeLayout>
 </RelativeLayout>
EJERCICIO 5: RELATIVE LAYOUT EN
OBJETOS
 Conclusión:
 El RelaytiveLayout nos permite posicionar los elementos con respecto a
otros. Los atributos que nos sirven para, son:
 android:layout_above: Indica que el elemento se posicionará justo
encima del elemento que tiene el ID definido como valor de este
atributo.
 android:layout_toLeftOf: Indica que el elemento se posicionará a la
izquierda del elemento cuyo ID coincida con el definido en el valor de
este atributo.
 android:layout_toRightOf: Indica que el elemento se posicionará a la
derecha del elemento cuyo ID coincida con el definido en el valor de este
atributo.
 android:layout_bottom: Posiciona al elemento debajo del que tenga la
ID proporcionada en el valor del atributo.
EJERCICIO 6: MARGENES
 <LinearLayout

xmlns:android="http://schemas.android.com/apk/r
es/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 <ImageView
 android:layout_margin="10dp"
 android:src="@drawable/sergio2"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_weight="1"
 android:scaleType="centerCrop" />
 <TextView
 android:layout_marginLeft="10dp"
 android:layout_marginRight="10dp"
 android:text="You're invited"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_weight=""
 android:textColor="@android:color/white"
 android:textSize="34sp"
 android:background="#009688" />
 <TextView
 android:layout_marginLeft="10dp"
 android:layout_marginRight="10dp"
 android:layout_marginBottom="10dp"
 android:text="Bonfire at the beach"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_weight="0"
 android:textColor="@android:color/white"
 android:textSize="34sp"
 android:background="#009688"/>
 </LinearLayout>
Conclusión:
Programa que tiene contacto con LinearLayout, al igual que
insertar imágenes a la aplicación, pero en este caso se trabajan
con márgenes que se define por pixeles con distintos comandos
por ejemplo: android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp“
PRACTICA II
 EJERCICIO 1: BOTONES VERTICALES
 EJERCICIO 2: BOTONES VERTICALES Y HORIZONTALES
EJERCICIO 1: BOTONES VERTICALES
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout

xmlns:android="http://schemas.android.com/apk/re
s/android"
 xmlns:app="http://schemas.android.com/apk/res-
auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"

tools:context="com.example.lap_c_pc06.pruebalayou
t2.MainActivity">
 <ScrollView
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:orientation="vertical" >
 <Button
 android:id="@+id/button2"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button3"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button4"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button5"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button6"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button8"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button7"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button9"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button10"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button11"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button12"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button13"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button14"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button15"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button16"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button17"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button18"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button19"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 <Button
 android:id="@+id/button20"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Button" />
 </LinearLayout>
 </ScrollView>
 </LinearLayout>
EJERCICIO 1: BOTONES VERTICALES
 Conclusión:
 El scrollview es una herramienta que nos
permite hacer un cuadro como un layout
dentro de otro layout y que los
componentes que estén dentro se queden
en la superficie que abarque este, el
usuario que haga uso de la aplicación se
pueda desplazar dentro de este cuadro.
EJERCICIO 2: BOTONES VERTICALES Y
HORIZONTALES
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical“
 tools:context="com.example.lap_c_pc06.pruebalayout2.MainActivity">
 <ScrollView
 android:layout_width="match_parent"
 android:layout_weight="1">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:orientation="vertical">
 <Button
 android:id="@+id/button60"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button59"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button58"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button57"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button56"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button55"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button54"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button53"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button52"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button51"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button50"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button49"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button48"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button47"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button46"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button45"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button44"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button43"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 <Button
 android:id="@+id/button41"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:backgroundTint="@color/colorPrimary"
 android:text="Button" />
 </LinearLayout>
 </ScrollView>
 <HorizontalScrollView
 android:layout_width="match_parent"
 android:layout_weight="1">
 <LinearLayout
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:orientation="horizontal"
 <Button
 android:id="@+id/button42"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button78"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button77"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button76"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button75"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button74"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button73"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button72"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button71"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button70"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button69"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button68"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button67"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button66"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button65"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button64"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button63"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button62"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
 android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 <Button
 android:id="@+id/button61"
 android:layout_width="wrap_content"
 android:layout_height="223dp"
 android:layout_weight="1"
android:backgroundTint="@android:color/holo_green_dark"
 android:text="Button" />
 </LinearLayout>
 </HorizontalScrollView>
 </LinearLayout>
EJERCICIO 2: BOTONES VERTICALES Y
HORIZONTALES
 Conclusión:
 Aparte del uso del scroll view, se usa el scroll
view horizontal, que se usa para ordenar los
componentes de manera horizontal, al igual el
uso de la división de pantalla en dos partes
iguales y el desplazamiento de este en los
componentes usados.
PRACTICA 3
 EJERCICIO 1: INTERFACE DE PRUEBA
EJERCICIO 1: INTERFACE DE PRUEBA
 <?xml version="1.0" encoding="utf-8"?>
 <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@color/colorPrimary"
 tools:context="com.example.lab_c_pc_27.myapplication.MainActivity">
 <ImageView
 android:id="@+id/imageView"
 android:layout_width="96dp"
 android:layout_height="112dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="16dp"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.029"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:srcCompat="@drawable/CETIS" />
 <TextView
 android:id="@+id/textView"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="68dp"
 android:text="Bienvenidos"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.469"
 app:layout_constraintStart_toEndOf="@+id/imageView"
 app:layout_constraintTop_toTopOf="parent" />
 <Button
 android:id="@+id/button"
 android:layout_width="54dp"
 android:layout_height="38dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="Off"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/textView6" />
 <Button
 android:id="@+id/button2"
 android:layout_width="73dp"
 android:layout_height="40dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="Salir"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.972"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.982" />
 <TextView
 android:id="@+id/textView2"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="A la programación"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.22"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/imageView"
 app:layout_constraintVertical_bias="0.086" />
 <TextView
 android:id="@+id/textView3"
 android:layout_width="80dp"
 android:layout_height="17dp"
 android:layout_marginBottom="328dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:text="Con android"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.594"
 app:layout_constraintStart_toEndOf="@+id/textView2" />
 <TextView
 android:id="@+id/textView4"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="272dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:text="Estudiante de bachillerato"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent" />
 <TextView
 android:id="@+id/textView5"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="Un mundo fantastico te espera"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="@+id/textView4"
 app:layout_constraintVertical_bias="0.113" />
 <TextView
 android:id="@+id/textView6"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="Con Android"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.581" />
 <TextView
 android:id="@+id/textView7"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="Estas preparado?"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/textView6"
 app:layout_constraintVertical_bias="0.176" />
 <TextView
 android:id="@+id/textView8"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="No te arrepentiras"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.924" />
 </android.support.constraint.ConstraintLayout>
EJERCICIO 1: INTERFACE DE PRUEBA
 Conclusión:
 Se usa un constrainlayout para que el acomodo
de botones y los textview sea más sencillo para
el programador, dando así una mejor
experiencia tanto programador y usuario.
PRACTICA 4
 EJERCICIO 1: CALCULADORA 1 (TXT)
 EJERCICIO 1: CALCULADORA 1 (JAVA)
EJERCICIO 1: CALCULADORA 1 (TXT)
 <?xml version="1.0" encoding="utf-8"?>
 <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"

tools:context="com.example.lap_c_pc17.proyaecto2actividad4.
MainActivity">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="129dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:orientation="vertical"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.0"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.0">
 <TextView
 android:id="@+id/primern"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Inserte 1er No."
 android:textColor="@android:color/background_dark"
 android:textSize="18sp" />
 <EditText
 android:id="@+id/insnum1"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:ems="10"
 android:inputType="textPersonName"
 android:text="Inserta un número"
 android:textColor="@android:color/darker_gray"
 android:textSize="14sp" />
 <TextView
 android:id="@+id/segunn"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Inserte 2do No."
 android:textColor="@android:color/background_dark"
 android:textSize="18sp" />
 <EditText
 android:id="@+id/insnum2"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:ems="10"
 android:inputType="textPersonName"
 android:text="Inserta un número"
 android:textColor="@android:color/darker_gray"
 android:textSize="14sp" />
 </LinearLayout>
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="211dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="176dp"
 android:orientation="vertical"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.0"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.931">
 <Button
 android:id="@+id/btnsuma"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:onClick="operacionesSuma"
 android:text="+" />
 <Button
 android:id="@+id/btnresta"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:onClick="operacionesresta"
 android:text="-" />
 <Button
 android:id="@+id/btnmulti"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:onClick="operacionesmultiplicacion"
 android:text="*" />
 <Button
 android:id="@+id/btndivi"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:onClick="operacionesdivision"
 android:text="/" />
 </LinearLayout>
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="103dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:orientation="vertical"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.0"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.397">
 <TextView
 android:id="@+id/result"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="Resultado"
 android:textColor="@android:color/background_dark"
 android:textSize="@android:dimen/thumbnail_height"
 android:visibility="visible"
 tools:textSize="24sp" />
 <EditText
 android:id="@+id/insr"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:ems="10"
 android:inputType="textPersonName"
 android:text="Reusltado"
 android:textColor="@android:color/darker_gray"
 android:textSize="14sp" />
 </LinearLayout>
 </android.support.constraint.ConstraintLayout>
EJERCICIO 1: CALCULADORA 1 (JAVA)
 package com.example.lap_c_pc17.proyaecto2actividad4;
 import android.annotation.SuppressLint;
 import android.support.v7.app.AppCompatActivity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.EditText;
 public class MainActivity extends AppCompatActivity {
 public EditText insr, insnum1,insnum2;
 @SuppressLint("WrongViewCast")
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 insnum1=(EditText)findViewById(R.id.primern);
 insnum2=(EditText)findViewById(R.id.segunn);
 insr=(EditText)findViewById(R.id.result);
 }
 public void operacionesSuma(View view)
 {
 float suma;
 float n1 = Float.parseFloat(insnum1.getText().toString());
 float n2 = Float.parseFloat(insnum2.getText().toString());
 suma = n1 + n2;
 insr.setText(String.valueOf(suma));
 }
 public void operacionesresta(View view)
 {
 float resta;
 float n1 = Float.parseFloat(insnum1.getText().toString());
 float n2 = Float.parseFloat(insnum2.getText().toString());
 resta = n1 - n2;
 insr.setText(String.valueOf(resta));
 }public void operacionesmultiplicacion(View view)
 {
 float multiplicacion;
 float n1 = Float.parseFloat(insnum1.getText().toString());
 float n2 = Float.parseFloat(insnum2.getText().toString());
 multiplicacion = n1 * n2;
 insr.setText(String.valueOf(multiplicacion));
 }public void operacionesdivision(View view)
 {
 float division;
 float n1 = Float.parseFloat(insnum1.getText().toString());
 float n2 = Float.parseFloat(insnum2.getText().toString());
 division = n1/n2;
 insr.setText(String.valueOf(division));
 }
 }
Conclusión:
Es una calculadora en la que se necesita ingresar dos
números aleatorios y que al presionar algún botón
de +, -, * o / haga la operación correspondiente. Se
utiliza un código en java para especificar la función
que ejecutara cada botón.
PRACTICA 5
 EJERCICIO 1: PROGRAMA QUE INDICA SI UN NÚMERO ES PAR O IMPAR (TXT)
 EJERCICIO 1: PROGRAMA QUE INDICA SI UN NÚMERO ES PAR O IMPAR (JAVA)
EJERCICIO 1: PROGRAMA QUE INDICA SI
UN NÚMERO ES PAR O IMPAR (TXT)
 <?xml version="1.0" encoding="utf-8"?>
 <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context="com.example.lap_c_pc30.myapplication.MainActivity">
 <TextView
 android:id="@+id/textView"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:text="Escribe un numero"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.031"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.048" />
 <EditText
 android:id="@+id/editText_num"
 android:layout_width="179dp"
 android:layout_height="51dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="52dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:ems="10"
 android:hint="Numero"
 android:inputType="numberDecimal"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.073"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.126" />
 <Button
 android:id="@+id/button"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:onClick="Verificar"
 android:text="Determinar"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.501"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.476" />
 <TextView
 android:id="@+id/textView_resultado"
 android:layout_width="wrap_content"
 android:layout_height="31dp"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:hint="Resultado"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.501"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.661" />
 <Button
 android:id="@+id/button2"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="8dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:onClick="Lim"
 android:text="Borrar"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintVertical_bias="0.863" />
 </android.support.constraint.ConstraintLayout>
 @Override
 protected void onCreate(Bundle
savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

numero=(EditText)findViewById(R.id.editText_n
um);

resultado=(TextView)findViewById(R.id.textView
_resultado);
 }
 public void Verificar(View view){
 int num;
 String respuesta;
 num=
Integer.parseInt(numero.getText().toString());
 if (num%2==0)
 respuesta="Numero Par";
 else
 respuesta="Numero Impar";
 resultado.setText(respuesta);
 }
 public void Lim(View view)
 {
 numero.setText("");
 resultado.setText("");
 }
 }
Conclsion: Esta aplicación te dice si
una aplicación es par o impar en base
a unos cálculos asignados a un botón,
cuya función es decir si es par o impar,
a su vez cuenta con otro botón que
permite limpiar pantalla.
Calculadora con radiobuttons
 <?xml version="1.0" encoding="utf-8"?>
 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context=".MainActivity">
 <EditText
 android:id="@+id/num1"
 android:layout_width="380dp"
 android:layout_height="55dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:ems="10"
 android:hint="Introcuce el primer numero "
 android:inputType="numberDecimal"
 android:textSize="24dp"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/textView" />
 <TextView
 android:id="@+id/textView"
 android:layout_width="180dp"
 android:layout_height="34dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:text="Calculadora"
 android:textSize="24dp"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.0"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toTopOf="parent" />
 <EditText
 android:id="@+id/num2"
 android:layout_width="375dp"
 android:layout_height="47dp"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="8dp"
 android:ems="10"
 android:hint="Introduce el segundo numero"
 android:inputType="numberDecimal"
 android:textSize="24dp"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/num1" />
 <RadioButton
 android:id="@+id/sum"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginEnd="8dp"
 android:layout_marginStart="8dp"
 android:layout_marginTop="28dp"
 android:text="Suma"
 android:textSize="24dp"
 app:layout_constraintEnd_toEndOf="parent"
 app:layout_constraintHorizontal_bias="0.029"
 app:layout_constraintStart_toStartOf="parent"
 app:layout_constraintTop_toBottomOf="@+id/num2" />
 <RadioButton
package com.example.stone.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
public class MainActivity extends AppCompatActivity {
public EditText num1;
public EditText num2;
public EditText resul;
public RadioButton rs,rr,rm,rd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
num1=(EditText)findViewById(R.id.num1);
num2=(EditText)findViewById(R.id.num2);
resul=(EditText)findViewById(R.id.resul);
rs=(RadioButton)findViewById(R.id.sum);
rr=(RadioButton)findViewById(R.id.res);
rm=(RadioButton)findViewById(R.id.mul);
rd=(RadioButton)findViewById(R.id.div);
}
public void operacion(View view){
float n1,n2,res;
n1=Float.parseFloat(num1.getText().toString());
n2=Float.parseFloat(num2.getText().toString());
if (rs.isChecked()==true){
res=n1+n2;
resul.setText(String.valueOf(res));
}else if(rr.isChecked()==true){
res=n1+n2;
resul.setText(String.valueOf(res));
}
else if(rm.isChecked()==true){
res=n1*n2;
resul.setText(String.valueOf(res));
}else if(rd.isChecked()==true){
res=n1/n2;
resul.setText(String.valueOf(res));
}
}
public void borrar(View view){
num1.setText("");
num2.setText("");

More Related Content

What's hot (11)

Fragment demo
Fragment demoFragment demo
Fragment demo
 
Pract 8
Pract 8Pract 8
Pract 8
 
Fragmentwithouttag
FragmentwithouttagFragmentwithouttag
Fragmentwithouttag
 
Kode program layout xml dan tampilan ui graphical (menggunakan eclipse)
Kode program layout xml dan tampilan ui graphical (menggunakan eclipse)Kode program layout xml dan tampilan ui graphical (menggunakan eclipse)
Kode program layout xml dan tampilan ui graphical (menggunakan eclipse)
 
Uts mb
Uts mbUts mb
Uts mb
 
Portafolio segundo parcial
Portafolio segundo parcialPortafolio segundo parcial
Portafolio segundo parcial
 
Pract 7
Pract 7Pract 7
Pract 7
 
Validando Formulários com AngularJS
Validando Formulários com AngularJSValidando Formulários com AngularJS
Validando Formulários com AngularJS
 
Client server part 14
Client server part 14Client server part 14
Client server part 14
 
Actividad 11
Actividad 11Actividad 11
Actividad 11
 
Actividad 9
Actividad 9Actividad 9
Actividad 9
 

More from marioorozco2g

More from marioorozco2g (18)

Crucigrama
CrucigramaCrucigrama
Crucigrama
 
Linea del tiempo android 06
Linea del tiempo android 06Linea del tiempo android 06
Linea del tiempo android 06
 
Organizador grafico 05
Organizador grafico 05Organizador grafico 05
Organizador grafico 05
 
Cuadro comparativo de los lenguajes de desarrollo 04
Cuadro comparativo de los lenguajes de desarrollo 04Cuadro comparativo de los lenguajes de desarrollo 04
Cuadro comparativo de los lenguajes de desarrollo 04
 
Cudro comparativo 03
Cudro comparativo 03Cudro comparativo 03
Cudro comparativo 03
 
Mapa conceptual aplicacions moviles
Mapa conceptual aplicacions movilesMapa conceptual aplicacions moviles
Mapa conceptual aplicacions moviles
 
Diagnostico potafolio 4g
Diagnostico potafolio 4gDiagnostico potafolio 4g
Diagnostico potafolio 4g
 
Portafolio 2do parcial blogg
Portafolio 2do parcial bloggPortafolio 2do parcial blogg
Portafolio 2do parcial blogg
 
Proyecto 1 (1)
Proyecto 1 (1)Proyecto 1 (1)
Proyecto 1 (1)
 
Mario 1520
Mario 1520Mario 1520
Mario 1520
 
11 y 12
11 y 1211 y 12
11 y 12
 
Bsd10
Bsd10Bsd10
Bsd10
 
Fin de semana acces
Fin de semana accesFin de semana acces
Fin de semana acces
 
Ejercicio 6 acces
Ejercicio 6 accesEjercicio 6 acces
Ejercicio 6 acces
 
Acces 2g 45
Acces 2g 45Acces 2g 45
Acces 2g 45
 
Acces 2
Acces 2Acces 2
Acces 2
 
Acces 2g
Acces 2gAcces 2g
Acces 2g
 
Slide share
Slide shareSlide share
Slide share
 

Portafolio

  • 1. PORTAFOLIO PARCIAL II JOSÉ RODRIGO QUINTERO VALDEZ 4.-”G”
  • 2. PRACTICA I  EJERCICIO 1: LISTA DE INVITADOS  EJERCICIO 2: LISTA DE INVITADOS EN PANTALLA COMPLETA  EJERCICIO 3: INSERTAR UNA IMAGEN  EJERCICIO 4: RELATIVE LAYOUT  EJERCICIO 5: RELATIVE LAYOUT EN OBJETOS  EJERCICIO 6: MARGENES
  • 3. EJERCICIO 1: LISTA DE INVITADOS  <LinearLayout  xmlns:android="http://schemas.android.com/apk/res/androi d"  android:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@android:color/darker_gray" >  <TextView  android:text="Lista de Invitados"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:background="#4CAF50"  android:textSize="24sp" />  <TextView  android:text="Oswaldo"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:background="#4CAF50"  android:textSize="24sp" />  <TextView  android:text="Axel"  android:layout_width="wrap_content"  android:layout_height="50dp"  android:background="#4CAF50"  android:textSize="24sp" />  <TextView  android:text="Elian"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:background="#4CAF50"  android:textSize="24sp" />  </LinearLayout> Conclusión: Iniciamos con un programa para experimentar con el LinearLayout de manera sencilla. Fue un programa fácil y sin una interface complicada.
  • 4. EJERCICIO 2: LISTA DE INVITADOS EN PANTALLA COMPLETA  <LinearLayout  xmlns:android="http://schemas.android.com/ap k/res/android"  android:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@android:color/darker_gr ay" >  <TextView  android:text="Lista de Invitados"  android:layout_width="match_parent"  android:layout_weight="1"  android:background="#4CAF50"  android:textSize="24sp" />  <TextView  android:text="Oswaldo"  android:layout_width="match_parent"  android:layout_weight="1"  android:background="#4CAF50"  android:textSize="24sp" />  <TextView  android:text="Axel“  android:layout_width="match_parent“  android:layout_weight="1"  android:background="#4CAF50"  android:textSize="24sp" />  <TextView  android:text="Elian"  android:layout_width="match_parent"  android:layout_weight="1"  android:background="#4CAF50"  android:textSize="24sp" />  </LinearLayout> Conclusión: Programa que tiene contacto con LinearLayout, al igual con las divisiones de pantalla, que a través de un comando (android:layout_weight="1“) Tiene una proporción que se adapta a la pantalla.
  • 5. EJERCICIO 3: INSERTAR UNA IMAGEN  <LinearLayout  xmlns:android="http://schemas.android.com/a pk/res/android"  android:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@android:color/darker_g ray">  <ImageView  android:layout_width="wrap_content"  android:layout_height="345dp"  android:layout_weight="1"  android:scaleType="centerCrop"  android:src="@drawable/sergio2" />  <TextView  android:text="You're invited!"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:layout_weight="1"  android:textColor="@android:color/white"  android:background="#009688"  android:textSize="54sp" />  <TextView  android:layout_height="wrap_content"  android:layout_weight="1"  android:layout_width="match_parent"  android:background="#009688"  android:text="Bonfire at the beach"  android:textColor="@android:color/white"  android:textSize="34sp" />  </LinearLayout> Conclusión: Programa que tiene contacto con LinearLayout, al igual que insertar imágenes a la aplicación, que se debe pegar en la carpeta “Drawable” del proyecto en función y llamarse por la siguiente línea de código “android:src="@drawable/sergio2“”.
  • 6. EJERCICIO 4: RELATIVE LAYOUT  <RelativeLayout  xmlns:android="http://schemas.android.com/apk/ res/android"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:padding="16dp" >  <TextView  android:text="I'm in this corner"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentBottom="true"  android:layout_alignParentLeft="true" />  <TextView  android:text="Wait, I'm here"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentTop="true"  android:layout_alignParentLeft="true" />  <TextView  android:text="Wait, I'm here"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentBottom="true"  android:layout_alignParentRight="true" />  <TextView  android:text="Actually, I'm here"  android:layout_height="wrap_content"  android:layout_width="wrap_content"  android:layout_alignParentTop="true"  android:layout_alignParentRight="true" />  </RelativeLayout> Conclusión: Programa que tiene contacto con RelativeLayout, que nos permite alinear con respecto al área que corresponde al RelativeLayout los objeto con el siguiente código: android:layout_alignParentTop="true“, el “Align” puede alinear con otro comando.
  • 7. EJERCICIO 5: RELATIVE LAYOUT EN OBJETOS  <RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent"  android:layout_height="match_parent" >  <?xml version="1.0" encoding="utf-8"?>  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@android:color/holo_orange_dark"  android:backgroundTint="@android:color/holo_orange_dark">  <TextView  android:id="@+id/lyla_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentBottom="true"  android:layout_alingParentLeft="true"  android:text="Lyla"  android:textSize="24sp" />  <TextView  android:id="@+id/me_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentBottom="true"  android:layout_toRightOf="@id/lyla_text_view"  android:text="Me"  android:textSize="24sp" />  <TextView  android:id="@+id/natalie_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="Natalie"  android:textSize="24sp" />  <TextView  android:id="@+id/jennie_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentBottom="true"  android:layout_alignParentRight="true"  android:text="Jennie"  android:textSize="24sp" />  <TextView  android:id="@+id/kunal_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentTop="true"  android:layout_centerHorizontal="true"  android:text="kunal"  android:textSize="24sp" />  <TextView  android:id="@+id/ben_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentTop="true"  android:layout_toRightOf="@id/kunal_text_view"  android:text="Ben"  android:textSize="24sp" />  <TextView  android:id="@+id/Amy_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentBottom="true"  android:layout_toLeftOf="@id/jennie_text_view"  android:text="Amy"  android:textSize="24sp" />  <TextView  android:id="@+id/Omoju_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_above="@+id/jennie_text_view"  android:layout_alignParentEnd="true"  android:layout_alignParentRight="true"  android:text="Omoju"  android:textSize="24sp" />  <TextView  android:id="@+id/Kagure_text_view"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_alignParentRight="true"  android:layout_alignParentTop="true"  android:text="Kagure"  android:textSize="24sp" />  </RelativeLayout>  </RelativeLayout>
  • 8. EJERCICIO 5: RELATIVE LAYOUT EN OBJETOS  Conclusión:  El RelaytiveLayout nos permite posicionar los elementos con respecto a otros. Los atributos que nos sirven para, son:  android:layout_above: Indica que el elemento se posicionará justo encima del elemento que tiene el ID definido como valor de este atributo.  android:layout_toLeftOf: Indica que el elemento se posicionará a la izquierda del elemento cuyo ID coincida con el definido en el valor de este atributo.  android:layout_toRightOf: Indica que el elemento se posicionará a la derecha del elemento cuyo ID coincida con el definido en el valor de este atributo.  android:layout_bottom: Posiciona al elemento debajo del que tenga la ID proporcionada en el valor del atributo.
  • 9. EJERCICIO 6: MARGENES  <LinearLayout  xmlns:android="http://schemas.android.com/apk/r es/android"  android:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="match_parent">  <ImageView  android:layout_margin="10dp"  android:src="@drawable/sergio2"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_weight="1"  android:scaleType="centerCrop" />  <TextView  android:layout_marginLeft="10dp"  android:layout_marginRight="10dp"  android:text="You're invited"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:layout_weight=""  android:textColor="@android:color/white"  android:textSize="34sp"  android:background="#009688" />  <TextView  android:layout_marginLeft="10dp"  android:layout_marginRight="10dp"  android:layout_marginBottom="10dp"  android:text="Bonfire at the beach"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:layout_weight="0"  android:textColor="@android:color/white"  android:textSize="34sp"  android:background="#009688"/>  </LinearLayout> Conclusión: Programa que tiene contacto con LinearLayout, al igual que insertar imágenes a la aplicación, pero en este caso se trabajan con márgenes que se define por pixeles con distintos comandos por ejemplo: android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginBottom="10dp“
  • 10. PRACTICA II  EJERCICIO 1: BOTONES VERTICALES  EJERCICIO 2: BOTONES VERTICALES Y HORIZONTALES
  • 11. EJERCICIO 1: BOTONES VERTICALES  <?xml version="1.0" encoding="utf-8"?>  <LinearLayout  xmlns:android="http://schemas.android.com/apk/re s/android"  xmlns:app="http://schemas.android.com/apk/res- auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  tools:context="com.example.lap_c_pc06.pruebalayou t2.MainActivity">  <ScrollView  android:layout_width="match_parent"  android:layout_height="match_parent">  <LinearLayout  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:orientation="vertical" >  <Button  android:id="@+id/button2"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button3"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button4"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button5"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button6"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button8"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button7"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button9"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button10"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button11"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button12"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button13"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button14"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button15"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button16"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button17"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button18"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button19"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  <Button  android:id="@+id/button20"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Button" />  </LinearLayout>  </ScrollView>  </LinearLayout>
  • 12. EJERCICIO 1: BOTONES VERTICALES  Conclusión:  El scrollview es una herramienta que nos permite hacer un cuadro como un layout dentro de otro layout y que los componentes que estén dentro se queden en la superficie que abarque este, el usuario que haga uso de la aplicación se pueda desplazar dentro de este cuadro.
  • 13. EJERCICIO 2: BOTONES VERTICALES Y HORIZONTALES  <?xml version="1.0" encoding="utf-8"?>  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:orientation="vertical“  tools:context="com.example.lap_c_pc06.pruebalayout2.MainActivity">  <ScrollView  android:layout_width="match_parent"  android:layout_weight="1">  <LinearLayout  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:orientation="vertical">  <Button  android:id="@+id/button60"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button59"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button58"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button57"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button56"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button55"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button54"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button53"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button52"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button51"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button50"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button49"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button48"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button47"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button46"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button45"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button44"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button43"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  <Button  android:id="@+id/button41"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:backgroundTint="@color/colorPrimary"  android:text="Button" />  </LinearLayout>  </ScrollView>  <HorizontalScrollView  android:layout_width="match_parent"  android:layout_weight="1">  <LinearLayout  android:layout_width="wrap_content"  android:layout_height="match_parent"  android:orientation="horizontal"  <Button  android:id="@+id/button42"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button78"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button77"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button76"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1" android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button75"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button74"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1" android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button73"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button72"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button71"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button70"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button69"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button68"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button67"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button66"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1" android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button65"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1" android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button64"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button63"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1" android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button62"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1"  android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  <Button  android:id="@+id/button61"  android:layout_width="wrap_content"  android:layout_height="223dp"  android:layout_weight="1" android:backgroundTint="@android:color/holo_green_dark"  android:text="Button" />  </LinearLayout>  </HorizontalScrollView>  </LinearLayout>
  • 14. EJERCICIO 2: BOTONES VERTICALES Y HORIZONTALES  Conclusión:  Aparte del uso del scroll view, se usa el scroll view horizontal, que se usa para ordenar los componentes de manera horizontal, al igual el uso de la división de pantalla en dos partes iguales y el desplazamiento de este en los componentes usados.
  • 15. PRACTICA 3  EJERCICIO 1: INTERFACE DE PRUEBA
  • 16. EJERCICIO 1: INTERFACE DE PRUEBA  <?xml version="1.0" encoding="utf-8"?>  <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@color/colorPrimary"  tools:context="com.example.lab_c_pc_27.myapplication.MainActivity">  <ImageView  android:id="@+id/imageView"  android:layout_width="96dp"  android:layout_height="112dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="16dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.029"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:srcCompat="@drawable/CETIS" />  <TextView  android:id="@+id/textView"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="68dp"  android:text="Bienvenidos"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.469"  app:layout_constraintStart_toEndOf="@+id/imageView"  app:layout_constraintTop_toTopOf="parent" />  <Button  android:id="@+id/button"  android:layout_width="54dp"  android:layout_height="38dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="Off"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@+id/textView6" />  <Button  android:id="@+id/button2"  android:layout_width="73dp"  android:layout_height="40dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="Salir"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.972"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.982" />  <TextView  android:id="@+id/textView2"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="A la programación"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.22"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@+id/imageView"  app:layout_constraintVertical_bias="0.086" />  <TextView  android:id="@+id/textView3"  android:layout_width="80dp"  android:layout_height="17dp"  android:layout_marginBottom="328dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:text="Con android"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.594"  app:layout_constraintStart_toEndOf="@+id/textView2" />  <TextView  android:id="@+id/textView4"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="272dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:text="Estudiante de bachillerato"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent" />  <TextView  android:id="@+id/textView5"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="Un mundo fantastico te espera"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="@+id/textView4"  app:layout_constraintVertical_bias="0.113" />  <TextView  android:id="@+id/textView6"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="Con Android"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.581" />  <TextView  android:id="@+id/textView7"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="Estas preparado?"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@+id/textView6"  app:layout_constraintVertical_bias="0.176" />  <TextView  android:id="@+id/textView8"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="No te arrepentiras"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.924" />  </android.support.constraint.ConstraintLayout>
  • 17. EJERCICIO 1: INTERFACE DE PRUEBA  Conclusión:  Se usa un constrainlayout para que el acomodo de botones y los textview sea más sencillo para el programador, dando así una mejor experiencia tanto programador y usuario.
  • 18. PRACTICA 4  EJERCICIO 1: CALCULADORA 1 (TXT)  EJERCICIO 1: CALCULADORA 1 (JAVA)
  • 19. EJERCICIO 1: CALCULADORA 1 (TXT)  <?xml version="1.0" encoding="utf-8"?>  <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  tools:context="com.example.lap_c_pc17.proyaecto2actividad4. MainActivity">  <LinearLayout  android:layout_width="match_parent"  android:layout_height="129dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:orientation="vertical"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.0"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.0">  <TextView  android:id="@+id/primern"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Inserte 1er No."  android:textColor="@android:color/background_dark"  android:textSize="18sp" />  <EditText  android:id="@+id/insnum1"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:ems="10"  android:inputType="textPersonName"  android:text="Inserta un número"  android:textColor="@android:color/darker_gray"  android:textSize="14sp" />  <TextView  android:id="@+id/segunn"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Inserte 2do No."  android:textColor="@android:color/background_dark"  android:textSize="18sp" />  <EditText  android:id="@+id/insnum2"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:ems="10"  android:inputType="textPersonName"  android:text="Inserta un número"  android:textColor="@android:color/darker_gray"  android:textSize="14sp" />  </LinearLayout>  <LinearLayout  android:layout_width="match_parent"  android:layout_height="211dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="176dp"  android:orientation="vertical"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.0"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.931">  <Button  android:id="@+id/btnsuma"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:onClick="operacionesSuma"  android:text="+" />  <Button  android:id="@+id/btnresta"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:onClick="operacionesresta"  android:text="-" />  <Button  android:id="@+id/btnmulti"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:onClick="operacionesmultiplicacion"  android:text="*" />  <Button  android:id="@+id/btndivi"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:onClick="operacionesdivision"  android:text="/" />  </LinearLayout>  <LinearLayout  android:layout_width="match_parent"  android:layout_height="103dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:orientation="vertical"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.0"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.397">  <TextView  android:id="@+id/result"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:text="Resultado"  android:textColor="@android:color/background_dark"  android:textSize="@android:dimen/thumbnail_height"  android:visibility="visible"  tools:textSize="24sp" />  <EditText  android:id="@+id/insr"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:ems="10"  android:inputType="textPersonName"  android:text="Reusltado"  android:textColor="@android:color/darker_gray"  android:textSize="14sp" />  </LinearLayout>  </android.support.constraint.ConstraintLayout>
  • 20. EJERCICIO 1: CALCULADORA 1 (JAVA)  package com.example.lap_c_pc17.proyaecto2actividad4;  import android.annotation.SuppressLint;  import android.support.v7.app.AppCompatActivity;  import android.os.Bundle;  import android.view.View;  import android.widget.EditText;  public class MainActivity extends AppCompatActivity {  public EditText insr, insnum1,insnum2;  @SuppressLint("WrongViewCast")  @Override  protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  setContentView(R.layout.activity_main);  insnum1=(EditText)findViewById(R.id.primern);  insnum2=(EditText)findViewById(R.id.segunn);  insr=(EditText)findViewById(R.id.result);  }  public void operacionesSuma(View view)  {  float suma;  float n1 = Float.parseFloat(insnum1.getText().toString());  float n2 = Float.parseFloat(insnum2.getText().toString());  suma = n1 + n2;  insr.setText(String.valueOf(suma));  }  public void operacionesresta(View view)  {  float resta;  float n1 = Float.parseFloat(insnum1.getText().toString());  float n2 = Float.parseFloat(insnum2.getText().toString());  resta = n1 - n2;  insr.setText(String.valueOf(resta));  }public void operacionesmultiplicacion(View view)  {  float multiplicacion;  float n1 = Float.parseFloat(insnum1.getText().toString());  float n2 = Float.parseFloat(insnum2.getText().toString());  multiplicacion = n1 * n2;  insr.setText(String.valueOf(multiplicacion));  }public void operacionesdivision(View view)  {  float division;  float n1 = Float.parseFloat(insnum1.getText().toString());  float n2 = Float.parseFloat(insnum2.getText().toString());  division = n1/n2;  insr.setText(String.valueOf(division));  }  } Conclusión: Es una calculadora en la que se necesita ingresar dos números aleatorios y que al presionar algún botón de +, -, * o / haga la operación correspondiente. Se utiliza un código en java para especificar la función que ejecutara cada botón.
  • 21. PRACTICA 5  EJERCICIO 1: PROGRAMA QUE INDICA SI UN NÚMERO ES PAR O IMPAR (TXT)  EJERCICIO 1: PROGRAMA QUE INDICA SI UN NÚMERO ES PAR O IMPAR (JAVA)
  • 22. EJERCICIO 1: PROGRAMA QUE INDICA SI UN NÚMERO ES PAR O IMPAR (TXT)  <?xml version="1.0" encoding="utf-8"?>  <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  tools:context="com.example.lap_c_pc30.myapplication.MainActivity">  <TextView  android:id="@+id/textView"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:text="Escribe un numero"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.031"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.048" />  <EditText  android:id="@+id/editText_num"  android:layout_width="179dp"  android:layout_height="51dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="52dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:ems="10"  android:hint="Numero"  android:inputType="numberDecimal"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.073"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.126" />  <Button  android:id="@+id/button"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:onClick="Verificar"  android:text="Determinar"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.501"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.476" />  <TextView  android:id="@+id/textView_resultado"  android:layout_width="wrap_content"  android:layout_height="31dp"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:hint="Resultado"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.501"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.661" />  <Button  android:id="@+id/button2"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginBottom="8dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:onClick="Lim"  android:text="Borrar"  app:layout_constraintBottom_toBottomOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent"  app:layout_constraintVertical_bias="0.863" />  </android.support.constraint.ConstraintLayout>
  • 23.  @Override  protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  setContentView(R.layout.activity_main);  numero=(EditText)findViewById(R.id.editText_n um);  resultado=(TextView)findViewById(R.id.textView _resultado);  }  public void Verificar(View view){  int num;  String respuesta;  num= Integer.parseInt(numero.getText().toString());  if (num%2==0)  respuesta="Numero Par";  else  respuesta="Numero Impar";  resultado.setText(respuesta);  }  public void Lim(View view)  {  numero.setText("");  resultado.setText("");  }  } Conclsion: Esta aplicación te dice si una aplicación es par o impar en base a unos cálculos asignados a un botón, cuya función es decir si es par o impar, a su vez cuenta con otro botón que permite limpiar pantalla.
  • 24. Calculadora con radiobuttons  <?xml version="1.0" encoding="utf-8"?>  <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  tools:context=".MainActivity">  <EditText  android:id="@+id/num1"  android:layout_width="380dp"  android:layout_height="55dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:ems="10"  android:hint="Introcuce el primer numero "  android:inputType="numberDecimal"  android:textSize="24dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@+id/textView" />  <TextView  android:id="@+id/textView"  android:layout_width="180dp"  android:layout_height="34dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:text="Calculadora"  android:textSize="24dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.0"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent" />  <EditText  android:id="@+id/num2"  android:layout_width="375dp"  android:layout_height="47dp"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="8dp"  android:ems="10"  android:hint="Introduce el segundo numero"  android:inputType="numberDecimal"  android:textSize="24dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@+id/num1" />  <RadioButton  android:id="@+id/sum"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:layout_marginEnd="8dp"  android:layout_marginStart="8dp"  android:layout_marginTop="28dp"  android:text="Suma"  android:textSize="24dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintHorizontal_bias="0.029"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@+id/num2" />  <RadioButton
  • 25. package com.example.stone.myapplication; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.RadioButton; public class MainActivity extends AppCompatActivity { public EditText num1; public EditText num2; public EditText resul; public RadioButton rs,rr,rm,rd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); num1=(EditText)findViewById(R.id.num1); num2=(EditText)findViewById(R.id.num2); resul=(EditText)findViewById(R.id.resul); rs=(RadioButton)findViewById(R.id.sum); rr=(RadioButton)findViewById(R.id.res); rm=(RadioButton)findViewById(R.id.mul); rd=(RadioButton)findViewById(R.id.div); } public void operacion(View view){ float n1,n2,res; n1=Float.parseFloat(num1.getText().toString()); n2=Float.parseFloat(num2.getText().toString()); if (rs.isChecked()==true){ res=n1+n2; resul.setText(String.valueOf(res)); }else if(rr.isChecked()==true){ res=n1+n2; resul.setText(String.valueOf(res)); } else if(rm.isChecked()==true){ res=n1*n2; resul.setText(String.valueOf(res)); }else if(rd.isChecked()==true){ res=n1/n2; resul.setText(String.valueOf(res)); } } public void borrar(View view){ num1.setText(""); num2.setText("");