Designing CardView, während es Parent ist ConstraintLayout?
Ich habe beim Bearbeiten von RelativeLayout in Cardview, das Relativelayout enthält, einen Fehler gemacht! ConstraintLayout ändert wrap_content des relativen Layouts auf 0 und fügt Werkzeuge hinzu: layout_editor_absoluteX = "10dp" Die gesamte Textansicht im relativen Layout wird oben rechts in der Kartenansicht ausgeblendet !!! (Element in der verschachtelten CardView wird an dem Element außerhalb der CardView ausgerichtet)
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="357dp"
android:layout_height="114dp"
android:layout_margin="5dp"
app:cardCornerRadius="2dp"
app:contentPadding="10dp"
app:cardElevation="10dp"
tools:layout_editor_absoluteY="36dp"
app:cardBackgroundColor="@android:color/white"
tools:layout_editor_absoluteX="11dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="10dp"
tools:layout_editor_absoluteY="10dp">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView2"
tools:text="Location"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<ImageView
android:src="@drawable/ic_hotel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView3"
tools:text="Bangalore"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
tools:layout_editor_absoluteX="10dp"
tools:layout_editor_absoluteY="10dp"
android:layout_alignBottom="@+id/imageView3"
android:layout_toRightOf="@+id/textView2"
android:layout_toEndOf="@+id/textView2" />
</android.support.v7.widget.CardView>
jeder Leitfaden zum Entwerfen von RelativeLayout mit ConstraintLayout wäre großartig, RelativeLayout kann bei der Verwendung von ConstraintLayout nicht überall verwendet werden. Wie lauten die Richtlinien für die Verwendung von untergeordneten Elementen einer CardView bei der Verwendung von RelativeLayout, während CardViews untergeordnete Elemente von ConstraintLayout sind?