Ich habe TableRow. In der Tabelle Zeile habe ich eine Textansicht.So legen Sie die Hintergrundfarbe für die Tabellenspalte in der Tabellenzeile fest
Textansicht Höhe sollte Wrap_content für meine Anforderung sein.
Wenn ich Hintergrundfarbe gebe Es wird auf die Textansicht festgelegt. Es füllt nicht die gesamte Zeile.
Genau wie das Bild unten
Aber was ich brauche, ist Hintergrund gesamte Spalte festgelegt werden sollte, anstatt Textview.
Hier habe ich meinen Code hinzugefügt.
<TableRow
android:id="@+id/tableRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:gravity="center"
android:minHeight="?attr/actionBarSize">
<TextView
android:id="@+id/subject"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="198"
android:background="@color/colorAccent"
android:gravity="center"
android:text="Subject"
android:textColor="@color/colorWhite"
android:textStyle="bold"></TextView>
<TextView
android:id="@+id/date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="98"
android:background="@color/colorSecondary"
android:gravity="center"
android:text="Date"
android:textColor="@color/colorWhite"
android:textStyle="bold"></TextView>
<TextView
android:id="@+id/Time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="98"
android:background="@color/colorPrimaryDark"
android:gravity="center"
android:text="Time"
android:textColor="@color/colorWhite"
android:textStyle="bold"></TextView>
</TableRow>
Legen Sie die Hintergrundfarbe in ID tableRow anstelle von Betreff fest. Ersetzen Sie auch> mit />. Es sorgt für einen saubereren Code. – apmartin1991