/ / comment mettre une ligne de séparation entre les éléments avec du texte dans l'androïde moyen? - Android, XML, mise en page, texte, diviseur

comment mettre la ligne de séparation entre les éléments avec du texte dans l'androïde moyen? - Android, XML, mise en page, texte, diviseur

J'essaie de concevoir mon application Android, donc j'ai besoin de créer une ligne de séparation avec du texte au milieu. J'ai utilisé ce code XML pour créer la ligne de séparation:

   <View
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@+id/login_button"
android:layout_marginTop="20dp"
android:background="@android:color/white"
/>

mais je n'ai pas trouvé comment mettre le texte au milieu.

comme ceci: ------- Texte ------- mais une ligne cohérente

Réponses:

0 pour la réponse № 1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="-----------------------------"
android:textColor="#ffff00" />

<TextView
android:id="@+id/but_book_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="This is button"
android:textColor="#ffff00" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="-----------------------------"
android:textColor="#ffff00" />

entrer la description de l'image ici