TextView ne pas afficher tout le texte
J'ai une Interface qui affiche les informations du client. Le problème que j'ai est certain nom du client(android:id="@+id/nomclient") est long et ne rentre pas dans le textview. quelle option je ahev donc etde pour les afficher, puis d'autres la possibilité de donner la pleine largeur de la présentation du nom ou du retrait du code textview de côté(comme on le voit dans le fichier xml android:id="@+id/nomclient").
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow>
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/customerCode" />
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/customerName" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/customerCode"
style="@style/CustomerTextView"
android:gravity="right" />
<TextView
android:id="@+id/customerName"
style="@style/CustomerTextView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="right"
android:maxEms="5" />
</TableRow>
<TableRow android:gravity="right" >
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/customerAddress" />
</TableRow>
<TableRow android:gravity="right" >
<TextView
android:id="@+id/customerAddress"
style="@style/CustomerTextView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="right"
android:maxEms="5"
/>
</TableRow>
<TableRow>
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/POBox" />
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/OrganizationName" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/poBox"
style="@style/CustomerTextView"
android:gravity="right" />
<TextView
android:id="@+id/organizationName"
style="@style/CustomerTextView"
android:gravity="right" />
</TableRow>
<TableRow>
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/fax" />
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/phone" />
</TableRow>
====================================STYLE++++++++++++++++++++++++++++++++++++++++
<style name="CustomerTextView">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:layout_margin">5dp</item>
<item name="android:background">@drawable/textview_border</item>
- Ce sur android:lignes="4" attribut
- J'ai essayé ceci, mais ne fonctionne pas <TextView android:id="@+id/nomclient" style="@style/CustomerTextView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:gravity="droite" android:maxEms="5" android:lignes="4" />
Vous devez vous connecter pour publier un commentaire.
Je l'ai corrigé en utilisant
espère que cela fonctionne pour vous aussi.
Une option est de faire ellipsize, donc si un nom est Vraiment le Nom Long", il peut se montrer comme "Vraiment Lon...". Pour ce faire:
D'autre part, vous pouvez faire le textview modifier la taille pour adapter le texte à l'aide de:
Mais je ne sais pas si ça marchera avec tout ce que vous essayez de le faire (par exemple fill_parent et la largeur à l'intérieur d'un tablerow)
supprimer la
android:maxEms="5"
ligne dans le fichier xml et que d'essayer<TextView android:id="@+id/customerName" style="@style/CustomerTextView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:gravity="center" />
Vous pouvez faire le TextView développez une deuxième ligne par la mise en singleLine attribut à false.
Vous pouvez essayer et faire le textview défilement de sorte que lorsque les données à afficher est de trop,le défilement va révéler le texte caché.
Dans le fichier xml,changement LinearLayout à ScrollView mise en page.