J'ai cette mise en page:vue Aligner au centre d'une autre vue
que j'ai crée avec ce code:
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/BusinessLogoCircleImageView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="36dp"
android:layout_marginBottom="36dp"
android:layout_gravity="right|end"
android:background="#ff4fc3f7" />
<LinearLayout
android:layout_toRightOf="@+id/BusinessLogoCircleImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:text="Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/BusinessNameTextView"
android:background="@color/primary_color"
android:textSize="@dimen/Address_Text_size"
android:textColor="@color/white"
android:typeface="normal" />
<TextView
android:text="Address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/BusinessAddressTextView"
android:layout_below="@+id/BusinessNameTextView"
android:background="@color/primary_color"
android:textSize="@dimen/Address_Text_size"
android:textColor="@color/white"
android:typeface="normal" />
<TextView
android:text="Website"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/BusinessWebsiteTextView"
android:layout_below="@+id/BusinessAddressTextView"
android:background="@color/primary_color"
android:textSize="@dimen/Address_Text_size"
android:textColor="@color/white"
android:typeface="normal" />
</LinearLayout>
<TextView
android:text="5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/CommentsCountTextView"
android:layout_below="@+id/BusinessLogoCircleImageView"
android:gravity="center"
android:background="@color/primary_color"
android:textSize="@dimen/Counter_Default_size"
android:textColor="@color/white"
android:typeface="normal" />
<TextView
android:text="overall thanks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/CommentsCountTextView"
android:id="@+id/CommentsTextTextView"
android:gravity="center"
android:padding="3dp"
android:textSize="@dimen/SubCounter_Text_size"
android:textColor="@color/white"
android:background="@color/subtitle_color"
android:typeface="normal" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/CommentsTextTextView"
android:id="@+id/StaffTeamListView" />
<TextView
android:id="@+id/emptyMessagesListTextView"
android:text=""
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center" />
Le problème est que je veux la 3 textview doit être dans le centre vertical de l'imageview sur la gauche. mais je ne sais pas comment faire cela, j'ai essayé avec la mise en page relative et également enveloppant ces textview sur une linearlayout
mais le problème est toujours le même, comment je peux définir la linearlayout pour centrer le contenu en fonction de l'image? si je peux le faire sans linearlayout je le préférerais, gardez à l'esprit aussi que je veux afficher une petite image (icône) sur la gauche de chaque textview.
Une solution que j'ai à l'esprit est si je mets l'imageview et la linearlayout avec les textviews dans une autre linearlayout et allign puis centre vertical mais est-ce la meilleure solution?
Vous voulez dire côte à côte? – peter
je veux que le centre de l'imageview soit égal au centre des 3 textviews ensemble – CDrosos