Material #1 Android Intermedio
-
Upload
wilmer-saldana -
Category
Documents
-
view
215 -
download
0
description
Transcript of Material #1 Android Intermedio
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 1/7
Material # 1
Ventana Splash
Profesor: Arón Elías HERRERA PONTEMétodo:
• Vamos a ir agregando los componentes uno por uno a nuestra nueva interface.
• Se mostrará, paso a paso, el contenido del archivo XML.
• Así mismo,
• Se mostrará el código “android, !ue se de"e escri"ir para controlar a cacomponente de la interface.
• Nota# Los nuevos "lo!ues de código son mostrados en color $%&%.
En resumen:• Vamos a ir agregando cada componente en el archivo XML '
• Vamos a escri"ir el código android en la clase &AVA para controlar los componente
Desarrollo:
PARTE I: Pantalla de Splash por tiempoHacar una pantalla de Splash en Android. Esta pantalla permanece durante 2 segundos y posteriormente inicia la aplicación.
main.xml
()*ml version+"1.0" encoding+"utf-8")(LinearLa'out *mlns#android+"http://schemas.android.com/apk/res/android" android#orientation+"vertical" android#la'out-idth+"ll_parent" android#la'out-height+"ll_parent" android#"ac/ground+"@drawable/fondo"( 0e*tVie
android#la'out-idth+"ll_parent" android#la'out-height+"wrap_content" android#te*t+"@strin/hello"
android#te*tSi1e+"!0dp"2(2LinearLa'out
splash.xml
()*ml version+"1.0" encoding+"utf-8")(LinearLa'out *mlns#android+"http://schemas.android.com/apk/res/android" android#la'out-idth+"match_parent" android#la'out-height+"match_parent" android#orientation+"vertical" android#"ac/ground+"@drawable/splash"
(2LinearLa'out
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 2/7
Android Manifest.xml
()*ml version+"1.0" encoding+"utf-8")(manifest *mlns#android+"http://schemas.android.com/apk/res/android" pac/age+"com.android.tienda" android#version3ode+"1"
android#version4ame+"1.0"
(uses5sd/ android#minSd/Version+"10" 2
(application android#icon+"@drawable/ic_launcher" android#la"el+"@strin/app_name" (activit' android#name+"ain#ctivit$" android#la"el+"@strin/app_name" (intent56lter (action android#name+"android.intent.action.#%&" 2
(categor' android#name+"android.intent.cateor$.'#(&)*+," 2 (2intent56lter (2activit' <ati!it" android:name"Tienda" android:la$el"@string/app_name" % <&ati!it"% (2application
(2manifest
Main Activitit
import android.app.Activit'7import android.content.8ntent7import android.os.9undle7import android.os.:andler7
pu$li lass MainActivit' e'tends Activit' ;pri!ate (nal int S<LAS:-=8S<LA>-L?4@0: + BBB7
C%verride pu$li !oid on3reateD9undle saved8nstanceStateE ; super.on3reateDsaved8nstanceStateE7 set3ontentVieD$.la'out.splashE7
ne) :andlerDE.post=ela'edDne) $unna"leDE; pu$li !oid runDE;2F<asados los dos segundos inicia la activit' G0iendaGF2
8ntent intent + ne) 8ntentDMainActivit'.this, 0ienda.lassE7 startActivit'DintentE7
2F=estru'e estaF2 6nishDE7 H7
H, S<LAS:-=8S<LA>-L?4@0:E7
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 3/7
HH
Tienda
import android.app.Activit'7
import android.os.9undle7
pu$li lass 0ienda e'tends Activit' ;
C%verride pu$li !oid on3reateD9undle saved8nstanceStateE ; super.on3reateDsaved8nstanceStateE7 set3ontentVieD$.la'out.mainE7 HH
R!n
"!ente
http#22es.i/icode.org2inde*.php2<antalla-de-Splash-en-Android-por-tiempo
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 4/7
PARTE II: Splash on animai*nstrin#s.xml
()*ml version+GI.BG encoding+GJ0K5G standalone+GnoG)(resources
(string name+GhelloG:ello orld(2string (string name+Gapp-nameG4uevas sorpresas en tu tienda Arón(2string (string name+GdescGdescripcion(2string(2resources
res$anim$fadein.xml
()*ml version+"1.0" encoding+"(-8")(set *mlns#android+"http://schemas.android.com/apk/res/android" (alpha android#duration+"1000" android#fromAlpha+"0.0" android#interpolator+"@android:anim/accelerate_interpolator"
android#repeat3ount+"0" android#toAlpha+"1.0" 2(2set
res$anim$fadeo!t.xml
()*ml version+"1.0" encoding+"(-8")(set *mlns#android+"http://schemas.android.com/apk/res/android" (alpha android#duration+"1000" android#fromAlpha+"1.0" android#interpolator+"@android:anim/accelerate_interpolator" android#repeat3ount+"0"
android#toAlpha+"0.0" 2
(2set
splash.xml
()*ml version+"1.0" encoding+"utf-8")(LinearLa'out *mlns#android+"http://schemas.android.com/apk/res/android" android#id+"@id/inicio" android#la'out-idth+"ll_parent" android#la'out-height+"ll_parent" android#"ac/ground+"" android#orientation+"vertical"
(8mageVie android#id+"@id/loo" android#content=escription+"@strin/desc" android#la'out-idth+"ll_parent" android#la'out-height+"ll_parent" android#adNustVie9ounds+"true" (28mageVie(2LinearLa'out
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 5/7
main.xml
()*ml version+"1.0" encoding+"utf-8")(LinearLa'out *mlns#android+"http://schemas.android.com/apk/res/android" android#orientation+"vertical" android#la'out-idth+"ll_parent"
android#la'out-height+"ll_parent" android#"ac/ground+"@drawable/fondo"( 0e*tVie
android#la'out-idth+"ll_parent" android#la'out-height+"wrap_content" android#te*t+"@strin/hello"
android#te*tSi1e+"!0dp"2(2LinearLa'out
Android Manifest.xml
()*ml version+"1.0" encoding+"utf-8")(manifest *mlns#android+"http://schemas.android.com/apk/res/android"
pac/age+"com.android.tienda" android#version3ode+"1" android#version4ame+"1.0" (uses5sd/ android#minSd/Version+"10" 2
(application android#icon+"@drawable/ic_launcher" android#la"el+"@strin/app_name" (activit' android#name+"ain#ctivit$" android#la"el+"@strin/app_name" (intent56lter (action android#name+"android.intent.action.#%&" 2 (categor' android#name+"android.intent.cateor$.'#(&)*+," 2 (2intent56lter (2activit'
<ati!it" android:name"Tienda" android:la$el"@string/app_name"% <&ati!it"%
(2application(2manifest
Tienda.%ava
import android.app.Activit'7import android.os.9undle7
pu$li lass 0ienda e'tends Activit' ;
C%verride pu$li !oid on3reateD9undle saved8nstanceStateE ; super.on3reateDsaved8nstanceStateE7 set3ontentVieD$.la'out.mainE7 HH
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 6/7
Main Activit
pa+a,e com.android.tienda7
import android.app.Activit'7import android.content.8ntent7import android.content.pm.Activit'8nfo7
import android.os.9undle7import android.vie.indo7import android.vie.indoManager7import android.vie.animation.Animation7import android.vie.animation.AnimationSet7import android.vie.animation.AnimationJtils7import android.vie.animation.Animation.AnimationListener7import android.idget.8mageVie7
pu$li lass MainActivit' e'tends Activit' ;AnimationSet animationSet78mageVie imagen7
C%verride pu$li !oid on3reateD9undle saved8nstanceStateE ; super.on3reateDsaved8nstanceStateE7 this.set$e!uested%rientationDActivit'8nfo. 2),++&_3,%+&#%3&_43,,#% E7 re!uestindoKeatureDindo.+#(,+_&3_%'+E7
this.getindoDE.setKlagsDindoManager.La'out<arams.'#5_(''2),++&,indoManager.La'out<arams.'#5_(''2),++&E7
set3ontentVieD$.la'out.splashE7 imagen + D8mageVieE 6ndVie9'8dD$.id.looE7 con6gurarAnimacionDE7 imagen.startAnimationDanimationSetE7 H
pu$li !oid con6gurarAnimacionDE; animationSet + ne) AnimationSetDtrueE7
Animation fadein + AnimationJtils.load#nimationDthis, $.anim.fadeinE7 fadein.set=urationDIBBBE7 Animation fadeout + AnimationJtils.load#nimationDthis, $.anim.fadeout E7 fadeout.set=urationDIBBBE7 fadeout.setStart%OsetDPQBBE7
animationSet.addAnimationDfadeinE7 animationSet.addAnimationDfadeoutE7 animationSet.setStart%OsetDIBBBE7
animationSet.setAnimationListenerDne) AnimationListenerDE;
C%verridepu$li !oid onAnimation?ndDAnimation animationE ;
22A!ui lan1ariamos la siguiente activit'
2F<asados los dos segundos inicia la activit' G0iendaGF2 8ntent intent + ne) 8ntentDMainActivit'.this, 0ienda.lassE7 startActivit'DintentE7
2F=estru'e estaF2
7/18/2019 Material #1 Android Intermedio
http://slidepdf.com/reader/full/material-1-android-intermedio 7/7
6nishDE7H
C%verridepu$li !oid onAnimation$epeatDAnimation animationE ;
22 T-D- Auto5generated method stu"H
C%verridepu$li !oid onAnimationStartDAnimation animationE ;
22 T-D- Auto5generated method stu"imagen.set8mage$esourceD$.draa"le.wikicodeE7
H
HE7
HH
R!n
"!ente
http#22es.i/icode.org2inde*.php2Splash-en-Android-con-animaciR3R9n
Home&or'
http#22.mo/asocial.com2PBII2B25simple5useful5android5*ml5animations2