2011-12-19 5 views
1

Y at-il quelque part le code de la recherche Google dans Android? La mise en page xml serait suffisante pour moi. Ou peut-être existe-t-il une possibilité d'ajouter un bouton à droite de l'EditText, tout comme ajouter une icône dans le coin? Merci.Android EditText comme Google Search EditText

+1

Vous pouvez voir [ma réponse ** ici **] (http://stackoverflow.com/a/11093987/1050058). Il est facile de changer l'icône vers la droite. Essayez-vous d'abord. Je vais ajouter un autre extrait plus tard avec l'icône dans le droit –

Répondre

1

Vous avez un LinearLayout avec une orientation horizontale où vous pouvez avoir un EditText, un ImageView avec l'image de recherche et un ImageView pour l'image du microphone. Tous devraient avoir les images de fond requises coupées de telle manière à sembler être une. C'est la notion générale. En ce qui concerne le code source, je ne peux pas vous aider!

Espérons que cela aide!

+0

Géré pour le faire? Besoin d'aide? –

2
<LinearLayout 
     android:id="@+id/mainLayout" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/bar"//set back ground for total look 
     android:orientation="horizontal" >    
     <EditText 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:hint="Your hint" 
      android:drawableRight="@drawable/search"//give your search icon 
      android:id="@+id/editBox" 
         />    
     <Button     
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/imageSpeak" 
      android:background="@drawable/iconSpeak"//icon for speak 
      /> 


</LinearLayout>