2015-04-02 2 views

Répondre

0

La seule façon d'y parvenir, la conception de la mise en page pour les imageviews et ajoutez chaque partie de votre image dans et drawable sélecteur d'utiliser pour changer l'image dans certains événements

Je pense que cette façon vous peut atteindre votre but enter image description here

essayer ci-dessous la mise en page

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 



    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:text="New Button"/> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:orientation="horizontal"> 
    <Button 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="New Button" 
     android:layout_weight="1" 
     android:id="@+id/button2" 
     android:layout_alignBottom="@+id/button3" /> 

    <Button 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="New Button" 
     android:layout_weight="1" 
     android:id="@+id/button3" 
     android:layout_alignParentTop="true" /> 
    </LinearLayout> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:orientation="horizontal"> 
      <Button 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:text="New Button" 
       android:layout_weight="1" 
       android:layout_alignBottom="@+id/button3" /> 

      <Button 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:text="New Button" 
       android:layout_weight="1" 
       android:layout_alignParentTop="true" /> 
     </LinearLayout> 

    </LinearLayout> 
</RelativeLayout> 
+0

Salut Abhishek, j'ajoute une imageview différente pour chaque partie mais maintenant le problème est avec une résolution d'écran différente toutes les parties ne s'alignent pas correctement car j'utilise une marge pour chaque partie. S'il vous plaît me suggérer une disposition comment puis-je réaliser cette chose entière intacte dans tous les types d'écrans ... –

+0

J'ai utilisé des boutons, mais vous devez utiliser des images, rendre l'image centrale transparente dans la nature et essayer de garder un grand écart des coins de l'image du centre – Abhishek

+0

Salut Abhishek, Merci pour votre réponse, maintenant je suis capable de créer la mise en page mais le problème ici est le bouton plus et moins devrait également être cliquable, donc comment ajouter ces boutons individuels et pour certains de l'élément Je ne suis pas en mesure d'ajouter un événement click. –