2010-01-21 8 views
0
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="50dip"> 
    <Button 
     android:text="Edit" 
     android:width="50dip" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" /> 
    <ToggleButton 
     android:textOn="All" 
     android:textOff="Wishlist" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentTop="true" /> 
    <Button 
     android:text="+" 
     android:width="50dip" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" /> 
</RelativeLayout> 

enter image description hereMode Android Comment?

J'ai ces trois boutons que je veux les aligner de façon similaire à la version iPhone. J'ai essayé d'utiliser la gravité et les choses mais je n'arrive pas à les faire ressembler sans positionnement absolu.

Merci

Donc, je l'ai compris. J'ai remplacé mon code original par la solution si quelqu'un en avait besoin.

Répondre

0

j'ai pu être assez étroite avec cette mise en page:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="50dip"> 

    <Button 
     android:text="Edit" 
     android:width="50dip" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_alignParentLeft="true"/> 

    <ToggleButton 
     android:text="Toggle" 
     android:textOn="All" 
     android:textOff="Wishlist" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_centerHorizontal="true"/> 

    <Button 
     android:text="+" 
     android:width="50dip" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_alignParentRight="true"/> 
</RelativeLayout> 
+0

Votre réponse est similaire à ma solution. Merci pour le coup de pouce à la bonne solution. – Jared

0

J'utiliserais personnellement un TableLayout pour accomplir cela.

+0

Merci pour la suggestion. J'ai pensé qu'il y avait un moyen d'accomplir ceci sans étendre la hiérarchie de vue avec plus de groupes de vue alors nécessaires. – Jared

Questions connexes