Ich habe diese Ansicht ->2 Ansichten in einer horizontalen Linearlayout
Die Ansicht im Grunde ist Setup wie dieses
LinearLayout -orientation horizontal - Height (wrap)
LinearLayout -orientation vertical - Height (wrap) - weight .65
TextView
RecyclerView
LinearLayout - orientation vertical - Height (matchparent) - weight .35
TextView
TextView
TextView
In den meisten Fällen die erste Linearlayout (die linke) würde die Größe in bestimmen Höhe, weil der RecyclerView normalerweise mehr als 1 Eintrag hat. Aber im Falle des Bildes der 1. Reihe funktioniert diese Logik nicht. Wenn ich das LinearLayout als Umbruch nach rechts verschiebe, dann ist, wenn das linke größer ist, Weiß um den grauen Hintergrund herum. Was ist der beste Weg, um das 2. Layout zu erreichen, ist immer die gleiche Höhe wie das Elternteil und wenn das Elternteil zu klein ist, stellt sich das Elternteil darauf ein.
hier ist die vollständige xml angefordert als
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginBottom="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:background="?attr/selectableItemBackground"
android:layout_width="match_parent" android:layout_height="wrap_content">
<ProgressBar android:id="@+id/progressBar" android:layout_width="wrap_content" android:layout_height="match_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".65"
android:orientation="vertical"
android:padding="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/tv_organization"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textStyle="bold"
tools:text="Duke Hospital"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/availablehours"
android:textAppearance="@android:style/TextAppearance.Small"/>
<TextView
android:id="@+id/rv_available_hours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:padding="0dp"
android:paddingBottom="4dp"
android:textAppearance="@android:style/TextAppearance.Small"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".35"
android:background="@color/offWhite"
android:gravity="center"
android:orientation="vertical"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/tv_notavailable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="@color/darkerGreyColor"
android:visibility="gone"/>
<TextView
android:id="@+id/tv_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textStyle="bold"
tools:text="30"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textAllCaps="true"
android:layout_gravity="center_horizontal"
android:text="@string/abbrev_min"/>
<TextView
android:id="@+id/tv_labelDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/estimatedwaittime"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</android.support.v7.widget.CardView>
kann die XML Sie Beiträge verfassen in Ihrem RecyclerView aufblasen? – mVck
@arinte müssen Sie height = "0dp" einstellen, wenn Sie Gewicht Eigenschaft nach mir –
@HarshKapoor das Gewicht ist für die Breite – arinte