SlideShare una empresa de Scribd logo
1 de 26
ENTORNOS
DE DESARROLLO
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
ANDROID
CONTROLES BÁSICOS
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTONES
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTONES
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN SIMPLE
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN SIMPLE
public class Actividad21 extends ActionBarActivity implements
OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) { …/…
texto=(TextView) findViewById(R.id.mitexto);
View boton=findViewById(R.id.miboton);
boton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
texto.setText("BOTÓN PULSADO");
}
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN SIMPLE
<Button
android:id="@+id/miboton“
android:text=“BOTÓN"
android:layout_width=“fill_parent"
android:layout_height="wrap_content“
/>
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN DOBLE
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN DOBLE
public class Actividad22 extends ActionBarActivity implements
OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) { …/…
texto=(TextView) findViewById(R.id.mitexto);
View boton1=findViewById(R.id.miboton1);
boton1.setOnClickListener(this);
View boton2=findViewById(R.id.miboton2);
boton2.setOnClickListener(this);
}
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN DOBLE
@Override
public void onClick(View v) {
if (v.getId()==R.id.miboton1){
texto.setText("BOTÓN 1 PULSADO");
}
else if (v.getId()==R.id.miboton2){
texto.setText("BOTÓN 2 PULSADO");
}
}
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN PULSADO
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
findViewById(R.id.miboton).setOnClickListener(new OnClickListener() {
public void onClick (View v) {
Button boton = (Button) v;
boton.setText(“BOTÓN PULSADO");
}
});
BOTÓN PULSADO: MÉTODO 1
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
public class Actividad21 extends ActionBarActivity implements
OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) { …/…
texto=(TextView) findViewById(R.id.mitexto);
View boton=findViewById(R.id.miboton);
boton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
texto.setText("BOTÓN PULSADO");
}
BOTÓN PULSADO: MÉTODO 2
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
public void metodoboton(View view) {
Button boton= (Button) findViewById(R.id.miboton);
boton.setText("BOTÓN PULSADO");
<Button
android:id="@+id/miboton“
android:text=“BOTÓN"
android:layout_width=“fill_parent"
android:layout_height="wrap_content“
android:onClick=“metodoboton”
/>
BOTÓN PULSADO: MÉTODO 3
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN MEJORADO
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
android:backgroud
android:drawable
android:padding
BOTÓN MEJORADO
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN LÓGICO
BOTONES
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTONES
import android.widget.ToggleButton;
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
<ToggleButton
android:id="@+id/miboton“
android:textOff=“OFF“
android:textOn=“ON"
android:layout_width=“fill_parent"
android:layout_height="wrap_content“
android:onClick=“metodoboton”
/>
BOTÓN LÓGICO
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTÓN GRÁFICO
BOTONES
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
BOTONES
import android.widget.ImageButton;
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
<ImageButton
android:id="@+id/miboton“
android:src=“@drawable/ok“
android:layout_width=“fill_parent"
android:layout_height="wrap_content“
android:onClick=“metodoboton”
/>
BOTÓN LÓGICO
ENTORNOS DE DESARROLLO
ANDROID: CONTROLES BÁSICOS
© J.D.CABRERA
ENTORNOS
DE DESARROLLO
Android botones guía

Más contenido relacionado

Similar a Android botones guía (16)

DISPOSITIVOS MÓVILES: CONTROLES DE BOTÓN
DISPOSITIVOS MÓVILES: CONTROLES DE BOTÓNDISPOSITIVOS MÓVILES: CONTROLES DE BOTÓN
DISPOSITIVOS MÓVILES: CONTROLES DE BOTÓN
 
DISPOSITIVOS MÓVILES: CONTROLES BÁSICOS
DISPOSITIVOS MÓVILES: CONTROLES BÁSICOSDISPOSITIVOS MÓVILES: CONTROLES BÁSICOS
DISPOSITIVOS MÓVILES: CONTROLES BÁSICOS
 
Manual marichuy
Manual marichuyManual marichuy
Manual marichuy
 
Manual marichuy
Manual marichuyManual marichuy
Manual marichuy
 
DISPOSITIVOS MÓVILES: LISTVIEW
DISPOSITIVOS MÓVILES: LISTVIEWDISPOSITIVOS MÓVILES: LISTVIEW
DISPOSITIVOS MÓVILES: LISTVIEW
 
android3Introduccion
android3Introduccionandroid3Introduccion
android3Introduccion
 
Las aplicasiones de androi ddd
Las aplicasiones de androi dddLas aplicasiones de androi ddd
Las aplicasiones de androi ddd
 
Tutorial de como hacer operaciones fáciles en eclipse
Tutorial de como hacer operaciones fáciles en eclipseTutorial de como hacer operaciones fáciles en eclipse
Tutorial de como hacer operaciones fáciles en eclipse
 
ENTORNOS DE DESARROLLO: ANDROID STUDIO - ESTRUCTURA
ENTORNOS DE DESARROLLO: ANDROID STUDIO - ESTRUCTURA ENTORNOS DE DESARROLLO: ANDROID STUDIO - ESTRUCTURA
ENTORNOS DE DESARROLLO: ANDROID STUDIO - ESTRUCTURA
 
ENTORNOS DE DESARROLLO: ECLIPSE - CONFIGURANDO EL ADB
ENTORNOS DE DESARROLLO: ECLIPSE - CONFIGURANDO EL ADB ENTORNOS DE DESARROLLO: ECLIPSE - CONFIGURANDO EL ADB
ENTORNOS DE DESARROLLO: ECLIPSE - CONFIGURANDO EL ADB
 
Aplicación móvil con acceso a datos
Aplicación móvil con acceso a datosAplicación móvil con acceso a datos
Aplicación móvil con acceso a datos
 
Manual marichuy
Manual marichuyManual marichuy
Manual marichuy
 
Manual marichuy
Manual marichuyManual marichuy
Manual marichuy
 
Manual marichuy
Manual marichuyManual marichuy
Manual marichuy
 
Xamarin - Aplicaciones Móviles con .Net
Xamarin - Aplicaciones Móviles con .Net Xamarin - Aplicaciones Móviles con .Net
Xamarin - Aplicaciones Móviles con .Net
 
DISPOSITIVOS MÓVILES: MENÚS Y SUBMMENÚS
DISPOSITIVOS MÓVILES: MENÚS Y SUBMMENÚSDISPOSITIVOS MÓVILES: MENÚS Y SUBMMENÚS
DISPOSITIVOS MÓVILES: MENÚS Y SUBMMENÚS
 

Más de Jacinto Cabrera Rodríguez

DISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONES
DISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONESDISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONES
DISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONESJacinto Cabrera Rodríguez
 

Más de Jacinto Cabrera Rodríguez (20)

REDES: DUCTUS Y CANALETAS II
REDES: DUCTUS Y CANALETAS IIREDES: DUCTUS Y CANALETAS II
REDES: DUCTUS Y CANALETAS II
 
OTRAS UNIDADES DE ALMACENAMIENTO
OTRAS UNIDADES DE ALMACENAMIENTOOTRAS UNIDADES DE ALMACENAMIENTO
OTRAS UNIDADES DE ALMACENAMIENTO
 
DISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONES
DISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONESDISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONES
DISPOSITIVOS MÓVILES: DIÁLOGOS Y NOTIFICACIONES
 
LAS FUENTES EN LA HISTORIA DEL ARTE
LAS FUENTES EN LA HISTORIA DEL ARTELAS FUENTES EN LA HISTORIA DEL ARTE
LAS FUENTES EN LA HISTORIA DEL ARTE
 
TOULOUSE LAUTREC
TOULOUSE LAUTRECTOULOUSE LAUTREC
TOULOUSE LAUTREC
 
PRÁCTICA MANEJO DE MEMORIA
PRÁCTICA MANEJO DE MEMORIAPRÁCTICA MANEJO DE MEMORIA
PRÁCTICA MANEJO DE MEMORIA
 
DISPOSITIVOS MÓVILES: MATERIAL DESIGN II
DISPOSITIVOS MÓVILES: MATERIAL DESIGN IIDISPOSITIVOS MÓVILES: MATERIAL DESIGN II
DISPOSITIVOS MÓVILES: MATERIAL DESIGN II
 
ZÓCALOS DE TARJETAS
ZÓCALOS DE TARJETASZÓCALOS DE TARJETAS
ZÓCALOS DE TARJETAS
 
ZÓCALOS DE PROCESADOR
ZÓCALOS DE PROCESADORZÓCALOS DE PROCESADOR
ZÓCALOS DE PROCESADOR
 
TIPOS DE MÓDULOS DE MEMORIA
TIPOS DE MÓDULOS DE MEMORIATIPOS DE MÓDULOS DE MEMORIA
TIPOS DE MÓDULOS DE MEMORIA
 
CARCASAS DE ORDENADOR
CARCASAS DE ORDENADORCARCASAS DE ORDENADOR
CARCASAS DE ORDENADOR
 
TIPOS DE TORNILLOS
TIPOS DE TORNILLOSTIPOS DE TORNILLOS
TIPOS DE TORNILLOS
 
PRACTICAS DE REDES: PRÁCTICA 26
PRACTICAS DE REDES: PRÁCTICA 26PRACTICAS DE REDES: PRÁCTICA 26
PRACTICAS DE REDES: PRÁCTICA 26
 
PRACTICAS DE REDES: PRÁCTICA 25
PRACTICAS DE REDES: PRÁCTICA 25PRACTICAS DE REDES: PRÁCTICA 25
PRACTICAS DE REDES: PRÁCTICA 25
 
PRACTICAS DE REDES: PRÁCTICA 24
PRACTICAS DE REDES: PRÁCTICA 24PRACTICAS DE REDES: PRÁCTICA 24
PRACTICAS DE REDES: PRÁCTICA 24
 
PRACTICAS DE REDES: PRÁCTICA 23
PRACTICAS DE REDES: PRÁCTICA 23PRACTICAS DE REDES: PRÁCTICA 23
PRACTICAS DE REDES: PRÁCTICA 23
 
REDES: TOMAS DE DATOS
REDES: TOMAS DE DATOSREDES: TOMAS DE DATOS
REDES: TOMAS DE DATOS
 
PRACTICAS DE REDES: PRÁCTICA 22
PRACTICAS DE REDES: PRÁCTICA 22PRACTICAS DE REDES: PRÁCTICA 22
PRACTICAS DE REDES: PRÁCTICA 22
 
PRACTICAS DE REDES: PRÁCTICA 21
PRACTICAS DE REDES: PRÁCTICA 21PRACTICAS DE REDES: PRÁCTICA 21
PRACTICAS DE REDES: PRÁCTICA 21
 
PRACTICAS DE REDES: PRÁCTICA 20
PRACTICAS DE REDES: PRÁCTICA 20PRACTICAS DE REDES: PRÁCTICA 20
PRACTICAS DE REDES: PRÁCTICA 20
 

Android botones guía

  • 1.
  • 3.
  • 4. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA ANDROID CONTROLES BÁSICOS
  • 5. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTONES
  • 6. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTONES import android.view.View; import android.view.View.OnClickListener; import android.widget.Button;
  • 7. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN SIMPLE
  • 8. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN SIMPLE public class Actividad21 extends ActionBarActivity implements OnClickListener { @Override public void onCreate(Bundle savedInstanceState) { …/… texto=(TextView) findViewById(R.id.mitexto); View boton=findViewById(R.id.miboton); boton.setOnClickListener(this); } @Override public void onClick(View v) { texto.setText("BOTÓN PULSADO"); }
  • 9. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN SIMPLE <Button android:id="@+id/miboton“ android:text=“BOTÓN" android:layout_width=“fill_parent" android:layout_height="wrap_content“ />
  • 10. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN DOBLE
  • 11. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN DOBLE public class Actividad22 extends ActionBarActivity implements OnClickListener { @Override public void onCreate(Bundle savedInstanceState) { …/… texto=(TextView) findViewById(R.id.mitexto); View boton1=findViewById(R.id.miboton1); boton1.setOnClickListener(this); View boton2=findViewById(R.id.miboton2); boton2.setOnClickListener(this); }
  • 12. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN DOBLE @Override public void onClick(View v) { if (v.getId()==R.id.miboton1){ texto.setText("BOTÓN 1 PULSADO"); } else if (v.getId()==R.id.miboton2){ texto.setText("BOTÓN 2 PULSADO"); } }
  • 13. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN PULSADO
  • 14. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA findViewById(R.id.miboton).setOnClickListener(new OnClickListener() { public void onClick (View v) { Button boton = (Button) v; boton.setText(“BOTÓN PULSADO"); } }); BOTÓN PULSADO: MÉTODO 1
  • 15. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA public class Actividad21 extends ActionBarActivity implements OnClickListener { @Override public void onCreate(Bundle savedInstanceState) { …/… texto=(TextView) findViewById(R.id.mitexto); View boton=findViewById(R.id.miboton); boton.setOnClickListener(this); } @Override public void onClick(View v) { texto.setText("BOTÓN PULSADO"); } BOTÓN PULSADO: MÉTODO 2
  • 16. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA public void metodoboton(View view) { Button boton= (Button) findViewById(R.id.miboton); boton.setText("BOTÓN PULSADO"); <Button android:id="@+id/miboton“ android:text=“BOTÓN" android:layout_width=“fill_parent" android:layout_height="wrap_content“ android:onClick=“metodoboton” /> BOTÓN PULSADO: MÉTODO 3
  • 17. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN MEJORADO
  • 18. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA android:backgroud android:drawable android:padding BOTÓN MEJORADO
  • 19. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN LÓGICO BOTONES
  • 20. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTONES import android.widget.ToggleButton;
  • 21. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA <ToggleButton android:id="@+id/miboton“ android:textOff=“OFF“ android:textOn=“ON" android:layout_width=“fill_parent" android:layout_height="wrap_content“ android:onClick=“metodoboton” /> BOTÓN LÓGICO
  • 22. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTÓN GRÁFICO BOTONES
  • 23. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA BOTONES import android.widget.ImageButton;
  • 24. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA <ImageButton android:id="@+id/miboton“ android:src=“@drawable/ok“ android:layout_width=“fill_parent" android:layout_height="wrap_content“ android:onClick=“metodoboton” /> BOTÓN LÓGICO
  • 25. ENTORNOS DE DESARROLLO ANDROID: CONTROLES BÁSICOS © J.D.CABRERA ENTORNOS DE DESARROLLO