IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

Affichage dans un AlertDialog


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2011
    Messages
    312
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2011
    Messages : 312
    Par défaut Affichage dans un AlertDialog
    Bonjour

    J'ai créé un AlertDialog personnalisé avec un bouton + un bouton moins et un EditText.
    un clic sur le bouton + ou - affiche 1 dans l'EditText
    Quand je teste, il n'y as pas d'affichage
    Voici mon code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    buttonP = (Button) alertDialogView.findViewById(R.id.btn_plus);
    	            	buttonM = (Button) alertDialogView.findViewById(R.id.btn_moins);
    //	            	final EditText textNbre = (EditText) alertDialogView.findViewById(R.id.editNbre);
    	            	buttonP.setOnClickListener(new View.OnClickListener() {
    	    	        	public void onClick(View v) {
    	    	        		PlusClick();
    	    	        	}
    	    				private void PlusClick() {
    	    					nbreText="1";
    	    					editTotal=(EditText) alertDialogView.findViewById(R.id.editNbre);
    	    					editTotal.setText(nbreText);
     
    	    				}
     
    	    	        });
    Je ne vois pas où est l'erreur
    Merci pour vos réponses

  2. #2
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Actuellement tu as implémenté uniquement le plus sur le bouton plus.

    Pourrais ton voir le layout associé ?

    Merci.

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2011
    Messages
    312
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2011
    Messages : 312
    Par défaut
    Bonjour

    Voici le code de mon layout associé

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="fill_horizontal" 
        android:paddingBottom="5px" 
        android:paddingTop="5px"
        android:background="@drawable/fenetre">
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="fill_horizontal" 
        android:paddingBottom="5px" 
        android:paddingTop="5px"
        android:background="@drawable/fenetre">
        	<TextView 
      		android:id="@+id/infos"
      		android:layout_weight="1" 
      		android:layout_height="fill_parent" 
      		android:layout_width="wrap_content" 
      		android:textSize="13px" 
      		android:paddingLeft="7px" 
      		android:textColor="#FFFFFF"
      		android:text="Indiquez la quantité (clic sur + ou -)" 
      		android:gravity="center_vertical|center_horizontal"/> 
        </LinearLayout>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="fill_horizontal" 
        android:paddingBottom="5px" 
        android:paddingTop="5px"
        android:background="@drawable/fenetre" android:paddingLeft="40px" android:paddingRight="40px">
        		<Button android:id="@+id/btn_moins"
    	    	android:text="-"
    	    	android:textSize="16px"
    			android:layout_width="10px"
    			android:layout_height="wrap_content"
    			android:layout_weight="1" 
    			android:textStyle="bold"
    			android:layout_marginLeft="20px" android:layout_marginRight="5px"/> 
      			<EditText 
       			android:layout_weight="1" 
        		android:id="@+id/editNbre" 
        		android:layout_width="20px"
    			android:layout_height="wrap_content"
        		android:textSize="20dip" 
        		android:text="0">
        		</EditText>
      			<Button android:id="@+id/btn_plus"
    	    	android:text="+"
    	    	android:textSize="16px"
    			android:layout_width="10px"
    			android:layout_height="wrap_content"
    			android:layout_weight="1" 
    			android:textStyle="bold" 
    			android:width="20px" android:layout_marginLeft="5px" android:layout_marginRight="20px"/> 
     
        </LinearLayout> 
      </LinearLayout>
    le bouton moins est bien implémenté, c'est parce que je ne pensais qu'il était utile de le joindre

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2011
    Messages
    312
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2011
    Messages : 312
    Par défaut
    C'est pas ca le layout associé ?

  5. #5
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Sisi,

    As-tu utilisé le débugueur pour voir si ton click était détecté ? ou au moins pour voir où ça clochait ?

  6. #6
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2011
    Messages
    312
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2011
    Messages : 312
    Par défaut
    Effectivement avec le debug, le clic n'est pas détecté
    Pourtant j'ai écrit ce code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    buttonM.setOnClickListener(new View.OnClickListener() {
    	public void onClick(View v) {
    		MoinsClick();
    	}
    	private void MoinsClick() {
    	       nbreText="1";
    	    	editTotal=(EditText) alertDialogView.findViewById(R.id.editNbre);
    	    	editTotal.setText(nbreText);
    	    	}
    	});
    C'est pas bon ?

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [CR8.5] Pbm d'affichage dans un While
    Par .:Tieri:. dans le forum SAP Crystal Reports
    Réponses: 1
    Dernier message: 14/07/2004, 10h17
  2. [mfc] affichage dans une boite de dialog
    Par chronos dans le forum MFC
    Réponses: 3
    Dernier message: 14/06/2004, 15h12
  3. [Flash MX] Pb d'affichage dans un textfield
    Par dens63 dans le forum Flash
    Réponses: 2
    Dernier message: 04/11/2003, 10h49
  4. Problème a l'affichage dans la console (printf)
    Par PhoneKilleR dans le forum C
    Réponses: 21
    Dernier message: 23/09/2003, 17h21
  5. affichage dans le front buffers ne marche pas!
    Par jamal24 dans le forum OpenGL
    Réponses: 3
    Dernier message: 22/08/2003, 19h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo