My xml file is using constraint layout the text does not gets wrapped properly, using the dependency 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:layout_width="254dp"
android:layout_height="100dp"
app:srcCompat="#mipmap/ic_launcher"
android:id="#+id/thumbnail_image_view"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp" />
<TextView
tools:text="name of the movie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/original_title"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/thumbnail_image_view"
app:layout_constraintLeft_toLeftOf="#+id/thumbnail_image_view" />
<TextView
tools:text="ReleaseDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/release_date"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/original_title"
app:layout_constraintLeft_toLeftOf="#+id/original_title" />
<TextView
tools:text="Ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/user_rating"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/release_date"
app:layout_constraintLeft_toLeftOf="#+id/release_date" />
<Button
tools:text="Favourite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/fav_btn"
android:layout_marginTop="96dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:onClick="addToFav"/>
<TextView
tools:text="ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups). It's similar to RelativeLayout in that all views are layed out according to relationships between sibling views and the parent layout, but it's more flexible than RelativeLayout and easier to use with Android Studio's Layout Editor.
Everything you can do with ConstraintLayout is available directly from the Layout Editor's visual tools, because the layout API and the Layout Editor were specially built for each other. So you can build your layout with ConstraintLayout entirely by drag-and-dropping instead of editing the XML."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/synopsis"
app:layout_constraintRight_toRightOf="#+id/fav_btn"
app:layout_constraintLeft_toLeftOf="#+id/user_rating"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="#+id/user_rating"
app:layout_constraintHorizontal_bias="0.0" />
</android.support.constraint.ConstraintLayout>
The design view looks like this:
Set padding in each component of your layout for example:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="#string/plus" />
Try this.
The answer is wrong. You should set constrain for the textView instead of using "wrap_content"
Related
image
For the tree I made LinearLayout (horizontal). It has an image and other LinearLayout which has text and button.
I tried to give weight to text and button, it keeps I am using nested weights. How should I fix it without an error?
If you want to use the LinearLayout here, there's no way around without nested weights. Google recommends using ConstraintLayout to keep the layout's hierarchy low.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.Guideline
android:id="#+id/glCenterVertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
<ImageView
android:id="#+id/imageView"
android:layout_width="0dp"
android:layout_height="150dp"
app:layout_constraintEnd_toEndOf="#id/glCenterVertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<Space
android:id="#+id/space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#id/imageView"
app:layout_constraintStart_toEndOf="#id/imageView"
app:layout_constraintTop_toTopOf="#id/imageView"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="#id/space"
android:text="Test"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/imageView"
app:layout_constraintTop_toTopOf="#id/imageView"/>
<Button
android:layout_width="wrap_content"
app:layout_constraintBottom_toBottomOf="#id/imageView"
android:text="Test"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/imageView"
app:layout_constraintTop_toTopOf="#id/space"
android:layout_height="wrap_content"/></androidx.constraintlayout.widget.ConstraintLayout>
I have made a simple layout that has an ImageView and two Buttons.
The layout as it shows on the preview is as follows:
Layout as shown in android studio preview
Where I run the emulator that I created for Lg3 (5.5" with 1440x2560), I get the following result (good result just like I designed)
Emulator result
However, when I actually download the apk to the real Lg3 device, the result is as follows:
Actual result
I tried using layout-normal, layout-small, layout-large however none worked.
The .xml looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/White"
tools:context=".MainActivity">
<ImageView
android:id="#+id/main_background"
android:layout_width="230dp"
android:layout_height="230dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="115dp"
android:src="#drawable/main_background" />
<Button
android:id="#+id/Sign_In"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="160dp"
android:layout_below="#+id/main_background"
android:layout_centerInParent="true"
android:background="#drawable/white_buttons"
android:fontFamily="#font/assistant"
android:text="Sign In"
android:textAllCaps="false"
android:textColor="#color/Fonts"
android:textSize="20dp" />
<Button
android:id="#+id/Sign_Up"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/Sign_In"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#drawable/colored_buttons"
android:fontFamily="#font/assistant"
android:text="Sign Up"
android:textAllCaps="false"
android:textColor="#color/White"
android:textSize="20dp" />
</RelativeLayout>
I was wondering if there is something im doing wrong that creates unequal result between the emulator and the real device.
Thank you very much
As CommonsWare mentioned - it may be because of different screen density.
My recommendation to you is to use ConstraintLayout to develop one layout for all screen sizes.
From the documentation:
ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups). It's similar to RelativeLayout in that all views are laid out according to relationships between sibling views and the parent layout, but it's more flexible than RelativeLayout and easier to use with Android Studio's Layout Editor.
Here is an example using ConstraintLayout without using fixed-sized values on your views:
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
tools:context=".MainActivity">
<Button
android:id="#+id/button"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="Button"
app:layout_constraintHeight_percent="0.1"
app:layout_constraintBottom_toTopOf="#+id/button2"
app:layout_constraintEnd_toEndOf="#+id/button2"
app:layout_constraintStart_toStartOf="#+id/button2" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:text="Button"
app:layout_constraintHeight_percent="0.1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="#+id/imageView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_percent="0.5"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="#tools:sample/avatars[14]" />
</androidx.constraintlayout.widget.ConstraintLayout>
It will look like this:
For more information about ConstraintLayout you can also guidelines and Chains to support different screen sizes.
I have a problem with correct display of ImageView. I want to display ImageView inside ConstraintLayout. On preview it looks exactly as i need, but when i'm starting it on device it looks completly dirrerent. This layout is places inside recycle view. What is wrong with this code?
<?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:id="#+id/promotionRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:background="#fff"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.constraint.ConstraintLayout
android:id="#+id/promotionImageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintHeight_default="spread"
android:background="#color/colorPrimary">
<ImageView
android:id="#+id/promotionImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#mipmap/ic_start_promotion"
android:background="#mipmap/ic_start_promotion"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHeight_min="150dp" />
<ImageView
android:id="#+id/fadeGradientImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="#drawable/fade_image_background" />
<TextView
android:text="Sample title"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:textColor="#ffffff"
android:id="#+id/promotionNameTextView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:paddingBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.constraint.ConstraintLayout>
<TextView
android:id="#+id/promotionDescriptionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:layout_marginTop="12dp"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="12dp"
android:text="Sampe description" />
</LinearLayout>
EDIT: Deep explanation:
I want to create row for RecycleView. Each row have to contains image, title and description. Title have to be in the left bottom corner of the image. Description have to be below the image. After that i have to put gradient (black in the bottom) into the image. Screen with "Preview" is exactly what i need.
EDIT2: Everything with this layout is ok. It is working as expected, i forget that i made some changes in kotlin code... Sory for problem.
First things first, every view should apply the attribute rules of its parent ViewGroup. ConstraintLayout doesn't support match_parent. It supports the 0dp value which means "match constraint". This way the view will expand to fill the constraint bounded space.
Next, ConstraintLayout was created to achieve a flat view hierarchy for better layout performance. So, never nest it inside a LinearLayout as it has the chains feature to get the same behavior in a more flexible way. Plus, you can achieve the structure with a ConstraintLayout at the top level .
Another thing, If you are going to define the same margin in all directions, you can just use layout_margin.
Finally, you have overdraw problems. ConstraintLayout is flexible enough to allow us to position views as backgrounds and help us avoid overlapped backgrounds.
Here's a solution:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/promotionRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#color/colorPrimary"
app:layout_constraintBottom_toBottomOf="#+id/promotion_image"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/promotion_image"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="#mipmap/ic_start_promotion"
app:layout_constraintHeight_min="150dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/shadow"
android:layout_width="0dp"
android:layout_height="80dp"
android:adjustViewBounds="true"
android:background="#drawable/fade_image_background"
app:layout_constraintBottom_toBottomOf="#+id/promotion_image"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="#+id/promotion_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Sample title"
android:textColor="#android:color/white"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#+id/promotion_image"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="#+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:padding="12dp"
android:text="Sampe description"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/promotion_image" />
</android.support.constraint.ConstraintLayout>
Try it. Hope this helps!
First of all, trying to write more presicely what do you want? Display image view inside layout it's somthing common words. As for your code, beside you don't have any constraints. You have strange view height, for second ImageView:
android:layout_height="match_parent"
It may overlay all other children view, it's very strange parameter.
UI with constraint layout shows good on Android Studio, but become irregular and scattered once I build and test on mobile. And when change my constraint layout to relative or linear layout, my design works perfectly. So, whats so good in constraint layout then if we can't code properly in it. Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background_color"
android:paddingHorizontal="#dimen/button_horizontal_padding">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="143dp"
android:layout_marginStart="143dp"
android:text="#string/booking_done_title"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteY="56dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/booking_done_sub_title"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteY="95dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_booking_done_image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteY="188dp" />
<Button
android:id="#+id/hotelBookNowBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginHorizontal="#dimen/button_horizontal_padding"
android:background="#drawable/green_button_background"
android:gravity="center"
android:paddingHorizontal="#dimen/button_horizontal_padding"
android:text="#string/done"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/white"
android:textStyle="normal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteY="353dp" />
<TextView
android:id="#+id/viewSummaryView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/view_full_summary"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteY="425dp" />
<android.support.constraint.Group
android:id="#+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.constraint.ConstraintLayout>
The tools namespace attributes enable design-time features that are only used in layout editor. The value of tools:layout_editor_absoluteY will have no effect on the View at runtime.
When a View is missing proper constraints, the layout editor will display a warning about it. However, in your case you have ignored these warnings by setting tools:ignore="MissingConstraints" for your Views. You have only set horizontal constraints for your Views but the vertical ones are missing.
In order to set constraints for a View in the layout editor you need to click on the circles at the edges of the View and drag them towards other Views or the edge of the parent. The constraints can also be set directly in the XML by using appropriate attributes. The full list can be found in the ConstraintLayout documentation
I was having the same issue and it turns out all the views you workin on has to be constraint. For example if you have a button at the bottom/middle of the layout and you want to stay in that place you need to use constraint to both side of the layout and bottom. Android studio give you a warning about this.
I am using constraint layout as parent, and added multiple child using constraint. There are three views horizontally and I have to apply rounded corner background for two view only, which was achieved by linear layout previously. But with the help of constraint layout, I am not able to achieve this.
How can I achieve this?
ConstraintLayout recently introduced the concept of constrainthelper which can be used to perform an action on a group of views. 'Group', which is used to toggle visibility of multiple view is subclass of this.
A constrainthelper which changes background of multiple views together is not yet a part of the stable release, but soon will be.
Until then, you can achieve a backround as in the example below, where 3 textview share a common background, using an View class:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#AAA">
<View
android:id="#+id/background"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#FFF"
app:layout_constraintBottom_toBottomOf="#+id/textView3"
app:layout_constraintEnd_toEndOf="#+id/textView1"
app:layout_constraintStart_toStartOf="#+id/textView1"
app:layout_constraintTop_toTopOf="#+id/textView1" />
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="TextView" />
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="#+id/textView1"
app:layout_constraintStart_toStartOf="#+id/textView1"
app:layout_constraintTop_toBottomOf="#+id/textView1"
tools:text="TextView" />
<TextView
android:id="#+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="#+id/textView1"
app:layout_constraintStart_toStartOf="#+id/textView1"
app:layout_constraintTop_toBottomOf="#+id/textView2"
tools:text="TextView" />
</android.support.constraint.ConstraintLayout>
EDIT: A nice blog on what to expect from ConstraintLayout 2.0
You can do it with simple Image View following this steps:
Put a Image view before text views
set Image view's start, top constraint to match first text view
Set Image view's end & bottom constraint to match last text views
This will gone stretch that imageview to a Rectangle defined by top-left of first view and bottom-right of last view.
Note that ImageView must be before text views:
<!--Background Image View-->
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:background="#drawable/lake"
app:layout_goneMarginRight="#dimen/activity_vertical_margin"
<!--Top_LEFT by first view-->
app:layout_constraintStart_toStartOf="heding"
app:layout_constraintTop_toTopOf="#+id/heding"
<!--BOTTOM RIGHT by last view-->
app:layout_constraintEnd_toEndOf="#+id/info"
app:layout_constraintBottom_toBottomOf="#+id/info"
/>
<!--first view-->
<TextView
android:id="#+id/heding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Lake Tahoe "
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.05"
app:layout_constraintStart_toEndOf="#+id/thumb"
app:layout_constraintTop_toTopOf="#+id/thumb"
tools:layout_constraintBottom_creator="1"
android:textColor="#FFF"
tools:layout_constraintTop_creator="1" />
<!--last view-->
<TextView
android:id="#+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="LakeTahoe is a large freshwater lake in Sierra Naveda"
android:textSize="15sp"
android:textColor="#FFF"
app:layout_constraintBottom_toBottomOf="#+id/thumb"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.05"
app:layout_constraintStart_toEndOf="#+id/thumb"
app:layout_constraintTop_toBottomOf="#+id/heding"
app:layout_constraintVertical_bias="1.0"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1" />
Result: