i encountered strange behavior of textview inside constraintlayout.
textview cuts text. on screenshot see 3 choices:
textview has width="match_parent" - correct bounds, text clipped;
textview has width="wrap_content" - incorrect bounds , text clipped again;
textview inside linearlayout - example of how should have been.
constraintlayout, what's wrong you?
here xml layout.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#727272" android:orientation="vertical" android:padding="16dp"> <android.support.constraint.constraintlayout android:id="@+id/block" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:padding="16dp"> <imageview android:id="@+id/img" android:layout_width="60dp" android:layout_height="60dp" android:background="#000000" app:layout_constraintleft_toleftof="@+id/block" app:layout_constrainttop_totopof="@+id/block" /> <textview android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="16dp" android:background="#cccccc" android:padding="6dp" android:text="lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." app:layout_constraintleft_torightof="@+id/img" app:layout_constraintright_torightof="@+id/block" app:layout_constrainttop_totopof="@+id/img" /> </android.support.constraint.constraintlayout> <android.support.constraint.constraintlayout android:id="@+id/block2" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:padding="16dp"> <imageview android:id="@+id/img2" android:layout_width="60dp" android:layout_height="60dp" android:background="#000000" app:layout_constraintleft_toleftof="@+id/block2" app:layout_constrainttop_totopof="@+id/block2" /> <textview android:id="@+id/text2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="16dp" android:background="#cccccc" android:padding="6dp" android:text="lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." app:layout_constraintleft_torightof="@+id/img2" app:layout_constraintright_torightof="@+id/block2" app:layout_constrainttop_totopof="@+id/img2" /> </android.support.constraint.constraintlayout> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:orientation="horizontal" android:padding="16dp"> <imageview android:layout_width="60dp" android:layout_height="60dp" android:background="#000000" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="16dp" android:background="#cccccc" android:padding="6dp" android:text="lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." /> </linearlayout>
ok, it's known bug , google promised
released in alpha 5
Comments
Post a Comment