Home Menu

Menu



Programación y Desarrollo para Android Subforo exclusivo para temas de programación de software para PDAs y desarrollo de aplicaciones, interfaces, etc bajo Android


 
Herramientas
  #1  
Viejo 22/02/14, 13:12:03
Avatar de canogt
canogt canogt no está en línea
Miembro del foro
Mensajes: 168
 
Fecha de registro: nov 2012
Localización: Tenerife
Mensajes: 168
Modelo de smartphone: lg g3
Versión de ROM: 4.1.2
Tu operador: Vodafone
Mencionado: 0 comentarios
Tagged: 0 hilos
Problema navegacion intems

Buenos días,

Tengo un problemilla con la navegación entre items en un layout.

no tengo definida ninguna propiedad de navigable o de focus, no tendría que ir pasando de un edittext a otro sin problema??

Por ejemplo en este linearlayout llego al primer campo y si pulso en el teclado para que vaya al siguiente edittext no hace nada, se queda en el primero siempre.

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
androidrientation="horizontal">

<TextView
android:id="@+id/lbPai"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="@string/strPai" />

<EditText
android:id="@+id/tiempoName"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:hint="00"
android:inputType="number"/>

<TextView
android:id="@+id/lbsepara"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:text=":" />

<EditText
android:id="@+id/segName"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:hint="00"
android:inputType="number" />

<TextView
android:id="@+id/lbmin"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="min" />

</LinearLayout>

Gracias
Responder Con Cita


  #2  
Viejo 22/02/14, 15:16:29
Avatar de canogt
canogt canogt no está en línea
Miembro del foro
Mensajes: 168
 
Fecha de registro: nov 2012
Localización: Tenerife
Mensajes: 168
Modelo de smartphone: lg g3
Versión de ROM: 4.1.2
Tu operador: Vodafone
Mencionado: 0 comentarios
Tagged: 0 hilos
Al final lo he solucionado con la propiedad

setNextFocusDownId

Pero ojo, si se define esa propiedad a nivel de layout (en el xml) puede dar error.

por lo que se hace en el activity de la siguiente forma:

En el onCreate
{
editText1=(EditText)findViewById(R.id.editText1);
editText2=(EditText)findViewById(R.id.editText2);
editText3=(EditText)findViewById(R.id.editText3);

setUpFocus();
}

private void setUpFocus(){
editText1.setNextFocusDownId(R.id.editText2);
editText2.setNextFocusDownId(R.id.editText8);// you can give focus to any id
editText3.setNextFocusDownId(R.id.editText9);
}
Responder Con Cita
Respuesta

Estás aquí
Regresar   HTCMania > Todo sobre Android > Programación y Desarrollo para Android


Reglas de Mensajes
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Las caritas están On
Código [IMG] está On
Código HTML está Off

Saltar a Foro



Hora actual: 02:24:47 (GMT +2)

Cookies
Powered by vBulletin™
Copyright © vBulletin Solutions, Inc. All rights reserved.
 
HTCMania: líderes desde el 2007