Semble être une question simple, mais je ne peux pas comprendre comment le faire. J'ai un LinearView horizontal avec quelque chose de taille fixe à gauche, puis vient un texte qui devrait prendre autant d'espace que possible, mais sur la droite devrait être un autre objet de taille fixe.Android: LinearView avec des widgets de taille fixe à gauche et à droite et un flexible au milieu
Maintenant, mes problèmes sont maintenant: Lorsque le texte au milieu est trop long, l'objet à droite est poussé hors de la fenêtre. Lorsque le texte est trop court, il ne se trouve pas à la bordure droite de la fenêtre, mais directement à côté du texte.
Comment puis-je le faire? Mon code à ce jour (Comme vous pouvez le voir, j'ai essayé d'utiliser le LayoutWeight, qui n'a pas aidé ...):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/important"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="10dp"
android:background="#000000"
android:layout_weight="1"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingRight="5dp"
android:paddingLeft="0dp"
android:textColor="#333333"
android:paddingBottom="0dp"
android:textSize="14sp"
android:scrollHorizontally="true"/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#666666"
android:paddingTop="3dp"
android:paddingRight="5dp"
android:paddingLeft="10dp"
android:paddingBottom="5dp"
android:textSize="12sp" />
</LinearLayout>
<ImageView android:id="@+id/lastpage"
android:src="@drawable/lastpage"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="200"
android:scaleType="center"
android:layout_gravity="right"/>
</LinearLayout>
Cela a fonctionné! Merci beaucoup! – janoliver
Heureux que je pourrais aider :) – sunadorer
Le lien de retour à cette page – inVINCEable