Wenn ich langen Text zu meinem TextView
im linearen Layout hinzufügen, nimmt es den ganzen Raum ein, und andere Ansichten werden gequetscht. Ich habe layout_width="0"
auf jede Ansicht gesetzt, aber es hat nicht geholfen. Ich sollte auch hinzufügen, dass dieses Layout in RecyclerView
verwendet wird.LinearLayout TextView Gewicht bricht mit langem Text
Hier ist mein Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="100">
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/lp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="Lp"
android:layout_weight="5" />
//this TextView takes all the space if text is long, but it behaves normally if text is short
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/nazwa"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="Końcówka Yankauer do odsysania pola operacyjnego CH 23 (4 otwory boczne) z kontrolą odsysania"
android:layout_weight="20"/>
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/ilosc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="#"
android:layout_weight="5" />
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/jednostka"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="JM"
android:layout_weight="15" />
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/cenaNetto"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="C. net."
android:layout_weight="15" />
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/wartNetto"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="W.net."
android:layout_weight="15" />
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/wartVAT"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="VAT"
android:layout_weight="10" />
<TextView
android:textSize="12sp"
android:gravity="center"
android:id="@+id/wartBrutto"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="W. brut."
android:layout_weight="15" />
</android.support.v7.widget.LinearLayoutCompat>
hier ein Druckbild von dem, was in meiner app bricht link
warum Sie verwenden Höhe "match_parent" für alle Textviews? –
Wenn ich es nicht hässlich wie [dies] (http://i.imgur.com/e98BEBl.png) – musztardus
Wenn Sie prozentualen Schraubstock sehen wollen, als versuchen, neue Konzept von android PercentRelativeLayout [Link] (https://developer.android.com/reference/android/support/percent/PercentRelativeLayout.html) – ashish