Les dépendances circulaires ne peuvent pas exister dans RelativeLayout, android?
J'ai le schéma suivant:
J'ai besoin de maintenir le bouton au bas de l'écran et elle devrait être visible à l'utilisateur.
Le reste de la mise en page doit défiler.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.vfc.sargroup.SalesOrderActivity$PlaceholderFragment" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottomLinearLayout" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Distributor Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Payment Collection"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
</EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Product Category"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<TableLayout
android:id="@+id/salesTableLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:stretchColumns="*" >
</TableLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total QTY"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Price"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remark"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
</EditText>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/bottomLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/scrollView1"
android:layout_centerHorizontal="true"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit" />
</LinearLayout>
</RelativeLayout>
J'ai juste besoin de faire défiler mon point de vue et maintenez le bouton est apparu sur l'écran en bas.
Le problème est avec
android:layout_above="@+id/bottomLinearLayout"
Je reçois le message d'erreur
Circular dependencies cannot exist in RelativeLayout
Quel est le problème avec ma mise en page?
Vous devez vous connecter pour publier un commentaire.
Le problème est causé parce qu'il y a une référence circulaire dans les paramètres de mise en page.
Par exemple, lors de l'affichage B est layout_below Une vue, Une vue ne peut pas référence à vue B plus il est en-dessous, alignRight etc. Cela peut également exister entre plusieurs points de vue: Une des références B références C. Dans le scénario C ne peut pas référence à Un à cause d'une dépendance circulaire.
Vous Avez Utilisé :-
bottomLinearLayout est ci-dessous scrollView1
Et puis vous avez dit que scrollView1 est au-dessus de bottomLinearLayout
Il ne marche pas comme ça.
Utiliser un
Vous ne pouvez pas dire le bottomLinearLayout est ci-dessous scrollView1 puis dire scrollView1 est au-dessus de bottomLinearLayout. Seulement un de ces deux.
C'est circulaire, car il va essayer de se positionner après les chiffres où l'autre est au... Qui est en attente sur la première.
Ajouter
android:layout_alignParentTop="true"
dans votre scrollView et supprimerandroid:layout_below="@+id/scrollView1"
dans le bottomLinearLayout.Placez votre parchemin vue dans une Relative Mise en page.
La structure sera: