Dans mon application Android, j'ai un onglet Activity
. Dans l'un des onglets, j'ai deux TextView
s et deux EditText
s.Android EditText ne prendra pas l'espace restant
Le premier EditText
est seulement une ligne, et c'est très bien. Cependant, je veux l'autre EditText
, android:id="@+id/paste_code"
, pour occuper l'espace restant, mais peu importe ce que je fais, il montrera seulement une ligne. Je ne veux pas définir manuellement le nombre de lignes, car le nombre qui convient à l'écran diffère en fonction de votre appareil.
Voici le code approprié. Il est imbriqué dans tous les composants nécessaires pour un onglet Activity
.
<ScrollView
android:id="@+id/basicTab"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Paste title"
android:layout_weight="0" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/paste_title_hint"
android:id="@+id/paste_title"
android:lines="1"
android:gravity="top|left"
android:layout_weight="0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Paste text"
android:layout_weight="0" />
<EditText
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:hint="@string/paste_hint"
android:id="@+id/paste_code"
android:gravity="top|left"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>
En effet; Merci pour ça. J'ai commenté l'autre réponse avec un lien vers une autre question SO qui a résolu mon problème. – Jamie
fonctionne comme un charme! – Damjan