Created
November 14, 2023 15:07
-
-
Save Sukhobrusov/af5608c520056e114743215eca1631f0 to your computer and use it in GitHub Desktop.
TableLayout, TextView.text with 0f width and 1 weight is cut when pressed by other views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TableLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:showDividers="beginning|middle|end" | |
android:padding="5dip" | |
android:id="@+id/table" | |
android:isScrollContainer="true" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content"> | |
<TableRow | |
android:showDividers="beginning|middle|end" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:layout_gravity="fill" | |
tools:textSize="14sp" | |
tools:textColor="@color/white" | |
tools:textStyle="bold" | |
tools:text="some text withing a text to add the text until there is no s\n | |
pace left for the other views and this can go on and on for\n | |
a long width. The key factor is the \\n. and the fact that \n | |
primary views WIDTH is WRAP_CONTENT\n when other views in its container are 0dp width and 1f\nweight" /> | |
<TextView | |
android:layout_width="0px" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:layout_margin="4dp" | |
android:layout_gravity="fill" | |
tools:textSize="14sp" | |
tools:textColor="@color/red_span" | |
tools:textStyle="bold" | |
tools:text="some text" /> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
tools:text="some text" /> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
tools:text="some text" /> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
tools:text="some text" /> | |
</TableRow> | |
</TableLayout> |
Author
Sukhobrusov
commented
Nov 14, 2023
<TextView android:layout_width="10dp" />
Table
- Row
- - Text wrap_content
- - Text 10dp
- - Text 10dp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment