je veux atteindre cet Réglage de la largeur de imageview match de textview largeur
ici est ma mise en page
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/black">
<ImageView
android:id="@+id/imf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/frame001"
/>
<TextView
android:id="@+id/firetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="170dp"
android:text="Android"
android:textStyle="bold"
android:textColor="@android:color/white" />
</RelativeLayout>
est-il possible à l'échelle la largeur de imageview pour mettre à l'échelle la largeur du texte vu que le texte dans le textview est dynamique
Je n'ai pas le temps d'écrire du code maintenant, mais vous pouvez prendre la taille du texte de la largeur et la largeur d'image réglée selon la largeur du texte ... voir ceci: http://stackoverflow.com/questions/21926644/ get-height-and-width-of-a-layout-programatically – AsfK
Utilisez les règles leftOf et RightOf de relativeLayout. Considérez aussi ceci: http://stackoverflow.com/questions/29956014/why-should-we-use-xml-layouts – Nanoc
Il suffit d'utiliser un ** composable drawable ** dans votre TextView (et se débarrasser de l'ImageView): mieux performances, design plus plat, très facile à mettre en œuvre. 'android: drawableTop =" @ drawable/frame001 "' –