J'essaie de configurer une page dans laquelle je peux mettre des informations dans une base de données, mais il y a trop d'une page sur une page. Je l'ai mis dans un ScrollView code> pour faire face à cela, mais le
eittext code> ne fonctionne pas, cela ne va pas montrer des indications ou me permettre de me mettre de l'information. Voici mon code: P>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".informationActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="300dp"
app:srcCompat="@drawable/bottle" />
<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="Name" />
<EditText
android:id="@+id/nameEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ems="10"
android:hint="Write here"
android:inputType="textPersonName" />
<TextView
android:id="@+id/priceTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="Price" />
<EditText
android:id="@+id/priceEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ems="10"
android:hint="...."
android:inputType="textPersonName" />
<TextView
android:id="@+id/goesWithTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="What does it go best with?" />
<EditText
android:id="@+id/goesWithEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ems="10"
android:hint="...."
android:inputType="textPersonName" />
<TextView
android:id="@+id/whereTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="Where did you get it?" />
<EditText
android:id="@+id/whereEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ems="10"
android:hint="...."
android:inputType="textPersonName" />
</LinearLayout>
</ScrollView>
3 Réponses :
Quelle est votre position d'EditText. Est-ce au bas de la mise en page. Également définir la largeur sur match_parent au lieu de 0 dp p>
Remplacez ci-dessous la ligne p> avec p> android:layout_width="match_parent"
Changer de votre mise en page EditText Largeur 0 à Match_Parent ou Wrap_Content
Vérifiez votre code maintenant P>
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="16dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:layout_marginBottom="300dp" app:srcCompat="@drawable/bottle" /> <TextView android:id="@+id/nameTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="16dp" android:text="Name" /> <EditText android:id="@+id/nameEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:ems="10" android:hint="Write here" android:inputType="textPersonName" /> <TextView android:id="@+id/priceTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="16dp" android:text="Price" /> <EditText android:id="@+id/priceEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:ems="10" android:hint="...." android:inputType="textPersonName" /> <TextView android:id="@+id/goesWithTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="16dp" android:text="What does it go best with?" /> <EditText android:id="@+id/goesWithEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:ems="10" android:hint="...." android:inputType="textPersonName" /> <TextView android:id="@+id/whereTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="16dp" android:text="Where did you get it?" /> <EditText android:id="@+id/whereEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:ems="10" android:hint="...." android:inputType="textPersonName" /> </LinearLayout> </ScrollView>
Je pense que vous devez donner à EditText Width comme Match_Parent / Wrap_Content Son travaille
Comme je l'ai dit dans mon Réponse ci-dessous , c'est probablement votre largeur EditText, mais peut être plus de choses, pour une question et des problèmes supplémentaires, N'hésitez pas à ré-poster dans votre question ou à soulever une autre question.
Si simple! Merci!
Pourquoi avez-vous accepté + a inaccepté ma réponse?
c'était un accident, je l'ai accepté à nouveau