I want to display a custom floating action button on top left corner of screen. There is Extended floating action button but it doesn't serve my purpose because i want a button with two images, one back icon and another activity image icon. So to achieve this look i used a custom cardview. But the problem is the button is hidden behind toolbar. How to bring it forward, i used elevation doesn't seem to be working.
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="#dimen/height_toolbar"
android:background="#drawable/background_small"
app:popupTheme="#style/AppTheme.PopupOverlay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/nav_button_image"
android:orientation="horizontal"
android:paddingBottom="5dp">
<!-- toolbar counter 1-->
<LinearLayout
android:id="#+id/linearLayout_app_bar_toolbar_plants"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="#id/linearLayout_app_bar_toolbar_to_do"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/plants"
android:textAllCaps="true"
android:textColor="#color/bg_color"
android:textSize="#dimen/text_size_textView_actionbar" />
<TextView
android:id="#+id/plant_count_appbar_main"
android:layout_width="wrap_content"
android:layout_height="#dimen/textView_size_actionbar"
android:layout_gravity="center"
android:text="0/0"
android:textAlignment="center"
android:textColor="#color/bg_color"
android:textSize="#dimen/text_size_textView_actionbar"
android:textStyle="bold" />
</LinearLayout>
<!-- toolbar counter 2-->
<LinearLayout
android:id="#+id/linearLayout_app_bar_toolbar_to_do"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#id/linearLayout_app_bar_toolbar_warnings"
app:layout_constraintStart_toEndOf="#id/linearLayout_app_bar_toolbar_plants"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/to_do"
android:textAllCaps="true"
android:textColor="#color/bg_color"
android:textSize="#dimen/text_size_textView_actionbar" />
<TextView
android:id="#+id/todo_count_appbar_main"
android:layout_width="wrap_content"
android:layout_height="#dimen/textView_size_actionbar"
android:layout_gravity="center"
android:text="0/0"
android:textAlignment="center"
android:textColor="#color/bg_color"
android:textSize="#dimen/text_size_textView_actionbar"
android:textStyle="bold" />
</LinearLayout>
<!-- toolbar counter 3-->
<LinearLayout
android:id="#+id/linearLayout_app_bar_toolbar_warnings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/linearLayout_app_bar_toolbar_to_do"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/warnings"
android:textAllCaps="true"
android:textColor="#color/bg_color"
android:textSize="#dimen/text_size_textView_actionbar" />
<TextView
android:id="#+id/warning_count_appbar_main"
android:layout_width="#dimen/textView_size_actionbar"
android:layout_height="#dimen/textView_size_actionbar"
android:layout_gravity="center"
android:background="#drawable/red_circle"
android:text="0"
android:textAlignment="center"
android:textColor="#color/bg_color"
android:textSize="#dimen/text_size_textView_actionbar"
android:textStyle="bold" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="#dimen/height_imageView_actionbar_logo"
android:layout_alignParentBottom="true"
android:scaleType="fitStart"
android:src="#drawable/gardify_logo_header" />
</RelativeLayout>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<include layout="#layout/content_main" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:layout_gravity="right"/>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
app:cardBackgroundColor="#color/colorPrimary"
android:elevation="10dp"
android:layout_marginTop="80dp"
app:cardCornerRadius="0dp"
app:popupTheme="#style/AppTheme.AppBarOverlay"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/margin_padding_size_small"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:src="#drawable/ic_back_arrow" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/gardify_app_icon_to_do_kalender" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Try using
app:elevation
instead of
android:elevation
Then set the elevation for cardview greater than the appbar/toolbar.
Try to move the <CardView /> element above the <AppBarLayout /> element
Related
i have two recyclers view in Fragment bottom sheet
the bottom sheet keeps moving with the recyceler view so that i will not be able to scroll the recycler views here is my code
`
<?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="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="#+id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<com.plus.medfastplus.customViews.views.CustomBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Press to manage your already assisted requests?"
android:textColor="#color/colorPrimary" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="40dp"
android:layout_height="40dp"
android:gravity="center">
<ImageView
android:id="#+id/imageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/ic_arrow_down" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="#+id/expandale_view"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginStart="20dp"
app:el_duration="1000"
app:el_expanded="false"
app:el_parallax="0.5">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/referral_recycler_view"
android:layout_width="match_parent"
android:fadeScrollbars="false"
android:layout_height="150dp"
/>
</net.cachapa.expandablelayout.ExpandableLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorPrimary" />
<com.plus.medfastplus.customViews.views.CustomRegularTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="What kind of assists you need?"
android:textColor="#color/black" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/services_recycler_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
/>
<com.plus.medfastplus.customViews.views.CustomBoldButton
android:id="#+id/back_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/rounded_button_abit_blue"
android:gravity="center"
android:text="#string/back"
android:textColor="#color/white" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
`
i have tried to add
nestedScrollingEnabled="false"
this seems to be works with only the other recycler view and the first one will not work
I have a sample view, where on the top is logo + header divider + some description, and from the bottom starts: Button + some checkboxes, please see image below:
It looks good on current devices, but on old phones, when screen is small (5 inches for example) - elements overlap:
View looks like below:
<androidx.constraintlayout.widget.ConstraintLayout android:id="#+id/parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- TOP -->
<ImageView
android:id="#+id/logo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="#drawable/loremipsum"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.12"
app:layout_constraintWidth_percent="0.50"
tools:ignore="ContentDescription" />
<ImageView
android:id="#+id/divider"
android:layout_width="match_parent"
android:layout_height="15dp"
android:scaleType="fitXY"
android:src="#drawable/header_divider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/logo"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="text"
android:lines="2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/divider"
android:textStyle="bold" />
<!-- BOTTOM -->
<LinearLayout
android:id="#+id/linearLayoutMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toTopOf="#+id/validIDLinearLayout"
android:orientation="vertical"
android:gravity="bottom"
android:visibility="visible">
<LinearLayout
android:id="#+id/linearLayoutMobilePhonePicker"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:visibility="visible">
<com.hbb20.CountryCodePicker
android:id="#+id/countryCodePickerId"
...
/>
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/mobileEditText"
android:layout_width="fill_parent"
android:hint="elo elo elo"
android:inputType="phone" />
</LinearLayout>
<TextView
android:id="#+id/mobileText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/fragment_terms_and_condition_send_sms" />
</LinearLayout>
<LinearLayout
android:id="#+id/validIDLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:gravity="center_vertical"
app:layout_constraintBottom_toTopOf="#+id/consentLinearLayout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/textViewValidIdBottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/errorRed"
android:text="text" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/consentLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="#id/privacyPolicyLinearLayout"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="32dp"
android:gravity="center_vertical"
android:background="#color/errorRed"
app:layout_constraintEnd_toEndOf="parent" >
<TextView
android:id="#+id/textViewConsent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/fragment_terms_and_condition_consent_VI" />
</LinearLayout>
<LinearLayout
android:id="#+id/privacyPolicyLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:gravity="center_vertical"
app:layout_constraintBottom_toTopOf="#id/button_continue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="#color/errorRed"
android:orientation="horizontal">
<TextView
android:id="#+id/textViewPrivacyPolicy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="true"
android:textColor="text"
android:text="#string/fragment_terms_and_condition_privacy_policy" />
</LinearLayout>
<TextView
android:id="#+id/button_continue"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:enabled="false"
android:background="#color/errorRed"
android:gravity="center"
android:text="ELO"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="80dp"
android:layout_marginTop="25dp"
app:layout_constraintWidth_percent="0.7" />
</androidx.constraintlayout.widget.ConstraintLayout>
How should I set constraint between this two parts of the view, so they wont overlap on small screen? Add marginTop to the bottom section?
I found an answer, will post below, maybe it helps someone in the future:
I copied all elements from Bottom section inside ScrollView:
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="#+id/header"
app:layout_constraintBottom_toBottomOf="parent"
android:fillViewport="true" >
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp" >
<!-- all LinearLayout's from bottom section -->
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
I'm really confused about how can I implement the navigation sidebar in my app, yet I already tried it but it conflicts and it tears down my design XML if I've implemented it. The conflict is when I change my constraintLayout to DrawLayout under activity_main my design will tear down but when implementing navigation sidebar I need to use DrawLayout instead of ConstraintLayout
Fist Image is the main XML the normal UI , the Second image describes the output when I tried to change my constraintlayout to drawerlayout in my activity main, some design didn't showed up, but the navigation sidebar works well like in the Third image. The question is it is possible to use constraintlayout instead of drawerlayout ? to avoid tearing down the UI design? or maybe there is other way to view the design using drawerLayout.
Activitymain.xml This is what I used in second Image using drawerlayout The navigation sidebar works well in this but the design teared down. but when I used <androidx.constraintlayout.widget.ConstraintLayout constraintlayout the UI layout will not tear down but it conflicts and the app crashed because in the MainActivity it using ActionBarDrawerToggle . I hope anyone can help me with this problem
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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"
android:id="#+id/drawerlayout"
tools:context=".MainActivity">
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/navigationview"
app:headerLayout="#layout/sidebar_header"
app:menu="#menu/sidemenu"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_gravity="start"/>
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/background"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="Toolbars"
app:titleTextColor="#FFFFFF"
app:titleMarginStart = "10dp"
android:layout_marginBottom="5dp"
tools:ignore="MissingConstraints"/>
<View
android:id="#+id/viewHeaderBackground"
android:layout_width="match_parent"
android:layout_height="#dimen/_125sdp"
android:background="#color/primary"
app:layout_constraintTop_toTopOf="parent"/>
<com.github.ybq.android.spinkit.SpinKitView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/spin_kit"
style="#style/SpinKitView.Large.Circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="#color/validation"
tools:ignore="MissingConstraints" />
<TextView
android:id="#+id/textTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_16sdp"
android:layout_marginLeft="#dimen/_16sdp"
android:layout_marginTop="#dimen/_16sdp"
android:text="Cash Grants"
android:textColor="#color/white"
android:textSize="#dimen/_20ssp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_26sdp"
android:layout_height="#dimen/_26sdp"
android:layout_marginEnd="#dimen/_16sdp"
android:layout_marginRight="#dimen/_16sdp"
android:src="#drawable/dswd_logo"
app:layout_constraintBottom_toBottomOf="#id/textTitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#id/textTitle"
app:tint="#color/white"
/>
<com.google.android.material.card.MaterialCardView
android:id="#+id/cardHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_16sdp"
android:layout_marginEnd="#dimen/_16sdp"
app:cardBackgroundColor="#color/card_background"
app:cardCornerRadius="#dimen/_16sdp"
app:layout_constraintBottom_toBottomOf="#id/viewHeaderBackground"
app:layout_constraintTop_toBottomOf="#id/viewHeaderBackground">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/_14sdp">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Overview"
android:textColor="#color/primary_text"
android:textSize="#dimen/_14ssp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageButton
android:id="#+id/textViews"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#android:color/transparent"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="#+id/layoutClients"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="#id/layoutImpacted"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/textViews">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_28sdp"
android:layout_height="#dimen/_28sdp"
android:src="#drawable/ic_clients"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="Sync"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_10ssp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="0"
android:textColor="#color/primary_text"
android:textSize="#dimen/_16ssp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/layoutImpacted"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="#id/layoutFollowing"
app:layout_constraintStart_toEndOf="#id/layoutClients"
app:layout_constraintTop_toBottomOf="#id/textViews">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_28sdp"
android:layout_height="#dimen/_28sdp"
android:src="#drawable/ic_impacted"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="Pending"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_10ssp"/>
<TextView
android:id="#+id/txtPending"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="0"
android:textColor="#color/primary_text"
android:textSize="#dimen/_16ssp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/layoutFollowing"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/layoutImpacted"
app:layout_constraintTop_toBottomOf="#id/textViews">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_28sdp"
android:layout_height="#dimen/_28sdp"
android:src="#drawable/ic_following"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="Spam"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_10ssp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="0"
android:textColor="#color/primary_text"
android:textSize="#dimen/_16ssp"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:overScrollMode="never"
android:padding="#dimen/_16sdp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/cardHeader">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/dashboard_item_1"/>
<include layout="#layout/dashboard_item_2"/>
<include layout="#layout/dashboard_item_3"/>
<include layout="#layout/dashboard_item_4"/>
</LinearLayout>
</ScrollView>
</androidx.drawerlayout.widget.DrawerLayout >
MainActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
drawerlayout = findViewById(R.id.drawerlayout);
navigationView = findViewById(R.id.navigationview);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,drawerlayout,toolbar,R.string.navigation_open,R.string.navigation_close);
drawerlayout.addDrawerListener(toggle);
toggle.syncState();
The question is it is possible to use constraintlayout instead of drawerlayout
Yes it is.
You just need to make sure that your design skeleton looks like:
<DrawerLayout>
<NavigationView>
<!--Main layout-->
<ConstraintLayout>
<view1 inside ConstraintLayout>
<view2 inside ConstraintLayout>
....
But what you did is that you replaced the ConstraintLayout with DrawerLayout so that the views could't be properly laid out with the unknown constraints:
<DrawerLayout>
<NavigationView>
<view1 inside ConstraintLayout>
<view2 inside ConstraintLayout>
....
So, applying that in your layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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"
android:id="#+id/drawerlayout"
tools:context=".MainActivity">
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/navigationview"
app:headerLayout="#layout/sidebar_header"
app:menu="#menu/sidemenu"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_gravity="start"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/background"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="Toolbars"
app:titleTextColor="#FFFFFF"
app:titleMarginStart = "10dp"
android:layout_marginBottom="5dp"
tools:ignore="MissingConstraints"/>
<View
android:id="#+id/viewHeaderBackground"
android:layout_width="match_parent"
android:layout_height="#dimen/_125sdp"
android:background="#color/primary"
app:layout_constraintTop_toTopOf="parent"/>
<com.github.ybq.android.spinkit.SpinKitView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/spin_kit"
style="#style/SpinKitView.Large.Circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="#color/validation"
tools:ignore="MissingConstraints" />
<TextView
android:id="#+id/textTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_16sdp"
android:layout_marginLeft="#dimen/_16sdp"
android:layout_marginTop="#dimen/_16sdp"
android:text="Cash Grants"
android:textColor="#color/white"
android:textSize="#dimen/_20ssp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_26sdp"
android:layout_height="#dimen/_26sdp"
android:layout_marginEnd="#dimen/_16sdp"
android:layout_marginRight="#dimen/_16sdp"
android:src="#drawable/dswd_logo"
app:layout_constraintBottom_toBottomOf="#id/textTitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#id/textTitle"
app:tint="#color/white"
/>
<com.google.android.material.card.MaterialCardView
android:id="#+id/cardHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_16sdp"
android:layout_marginEnd="#dimen/_16sdp"
app:cardBackgroundColor="#color/card_background"
app:cardCornerRadius="#dimen/_16sdp"
app:layout_constraintBottom_toBottomOf="#id/viewHeaderBackground"
app:layout_constraintTop_toBottomOf="#id/viewHeaderBackground">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/_14sdp">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Overview"
android:textColor="#color/primary_text"
android:textSize="#dimen/_14ssp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageButton
android:id="#+id/textViews"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#android:color/transparent"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="#+id/layoutClients"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="#id/layoutImpacted"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/textViews">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_28sdp"
android:layout_height="#dimen/_28sdp"
android:src="#drawable/ic_clients"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="Sync"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_10ssp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="0"
android:textColor="#color/primary_text"
android:textSize="#dimen/_16ssp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/layoutImpacted"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="#id/layoutFollowing"
app:layout_constraintStart_toEndOf="#id/layoutClients"
app:layout_constraintTop_toBottomOf="#id/textViews">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_28sdp"
android:layout_height="#dimen/_28sdp"
android:src="#drawable/ic_impacted"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="Pending"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_10ssp"/>
<TextView
android:id="#+id/txtPending"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="0"
android:textColor="#color/primary_text"
android:textSize="#dimen/_16ssp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/layoutFollowing"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_8sdp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/layoutImpacted"
app:layout_constraintTop_toBottomOf="#id/textViews">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="#dimen/_28sdp"
android:layout_height="#dimen/_28sdp"
android:src="#drawable/ic_following"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="Spam"
android:textColor="#color/secondary_text"
android:textSize="#dimen/_10ssp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_4sdp"
android:text="0"
android:textColor="#color/primary_text"
android:textSize="#dimen/_16ssp"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:overScrollMode="never"
android:padding="#dimen/_16sdp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/cardHeader">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/dashboard_item_1"/>
<include layout="#layout/dashboard_item_2"/>
<include layout="#layout/dashboard_item_3"/>
<include layout="#layout/dashboard_item_4"/>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.drawerlayout.widget.DrawerLayout >
I have activity with horizontal scroll view to display four button's. Below located FrameLayout witch display fragment based on what button was clicked. Second and Fourth button shows RecyclerView with a lot of data. How can i make this horizontal scroll view to stay on top below or in place of Toolbar, so i can switch between fragments withount going all the way up?
<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="#color/smoky_white"
android:orientation="vertical"
tools:context=".o_kaznau">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/purple_200"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:title="О КазНАИУ" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/toolbar"
app:layout_constraintVertical_bias="1.0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView11"
android:layout_width="match_parent"
android:layout_height="230dp"
android:scaleType="fitXY"
android:src="#drawable/im_maincorpus1"/>
<HorizontalScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="#+id/btnAbout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutAbout"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Об университете" />
<Button
android:id="#+id/btnRyk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutRyc"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Руководство" />
<Button
android:id="#+id/btnPolitika"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutPolitika"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Политика" />
<Button
android:id="#+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/about_btn"
android:onClick="aboutYstav"
android:textSize="15sp"
android:textAllCaps="false"
android:text="Устав" />
</LinearLayout>
</HorizontalScrollView>
<FrameLayout
android:id="#+id/aboutFL"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
I have this following 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/toolbar_with_filter_back" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="#drawable/banner"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
<android.support.constraint.Guideline
android:id="#+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="165dp" />
<android.support.v7.widget.CardView
android:id="#+id/win_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/_5sdp"
android:elevation="#dimen/_8sdp"
app:cardCornerRadius="#dimen/_10sdp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toBottomOf="#+id/guideline">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="#dimen/_10sdp">
<android.support.v7.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:gravity="center"
android:scaleType="fitXY"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/exec_business_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:scaleType="fitXY"
android:src="#drawable/icon_dairy" />
<TextView
android:id="#+id/exec_business_iconname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/exec_card_second_title"
android:fontFamily="#font/boutrosasma_regular"
android:gravity="center"
android:text="Foods"
android:textColor="#color/white"
android:textSize="#dimen/text_size_h" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="#+id/tvRname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:fontFamily="#font/boutrosasma_bold"
android:gravity="center"
android:text="#string/exe_size"
android:textColor="#color/exec_card_second_title"
android:textSize="#dimen/text_size_h_valve"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/fb_sr_bu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:fontFamily="#font/boutrosasma_regular"
android:gravity="center"
android:text="SR"
android:textColor="#color/exec_card_size_val_color"
android:textSize="#dimen/text_size_h"
android:textStyle="bold" />
<TextView
android:id="#+id/fb_size_val_bu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="#dimen/_5sdp"
android:ellipsize="end"
android:fontFamily="#font/boutrosasma_bold"
android:gravity="center"
android:text="56.9"
android:textColor="#color/exec_card_size_val_color"
android:textSize="#dimen/_14ssp"
android:textStyle="bold" />
<TextView
android:id="#+id/fb_bn_bu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:fontFamily="#font/boutrosasma_regular"
android:gravity="center"
android:text="BN"
android:layout_marginLeft="#dimen/_5sdp"
android:textColor="#color/exec_card_size_val_color"
android:textSize="#dimen/text_size_h"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="#drawable/layer_5" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="#+id/tvgrowth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:fontFamily="#font/boutrosasma_bold"
android:gravity="center"
android:text="#string/exe_growth"
android:textColor="#color/exec_card_second_title"
android:textSize="#dimen/text_size_h_valve"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="#+id/fb_growth_bu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:fontFamily="#font/boutrosasma_bold"
android:gravity="center"
android:text="+7.0%"
android:textColor="#color/exec_growth_val_color"
android:textSize="#dimen/_14ssp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/card_topplayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/_5sdp"
android:elevation="#dimen/_8sdp"
app:cardCornerRadius="#dimen/_10sdp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toBottomOf="#+id/win_card"
app:layout_constraintEnd_toEndOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/top_player_back"
android:padding="#dimen/_10sdp">
<TextView
android:id="#+id/top_player"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/boutrosasma_bold"
android:text="#string/business_unit_top"
android:textColor="#color/exec_card_size_val_color" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:src="#drawable/orientation" />
</RelativeLayout>
<com.github.mikephil.charting.charts.LineChart
android:layout_margin="#dimen/_5sdp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/business_lineChart"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
Problem 1:
When i set the second cardview height to match_parent then it takes the full screen instead of the left screen at the bottom. It means it will override the first cardview also and reach to the top of parent/screen. So in this case why the set constraint toptobottomof is not working and how can i make it work? As far as i know toptobottomof makes sure that your second view will always remain below of first view which in this case is not working.
Problem 2:
If i keep my layout as it is then the problem is the LineChart is not expanding at all. It is compressing the whole chart height into the wrap content height. It is not behaving like it needs more space as this is what wrap_content attribute is made for instead it is restricting the chart itself to that available height and its not expanding the cardview height at all.
Please help me with these issues.
Change height to 0dp of android.support.v7.widget.CardView , width to 0dp
and use app:layout_constraintBottom_toBottomOf="parent"
This will make the height fill to the parent
Add these
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Example
<androidx.cardview.widget.CardView
android:id="#+id/card_topplayer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="#dimen/_5sdp"
android:elevation="#dimen/_8sdp"
app:cardCornerRadius="#dimen/_10sdp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/win_card">
Update
To implement scrollview use fillviewport = true
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:fillViewport = "true"
android:layout_height="0dp">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
And Remove this app:layout_constraintEnd_toEndOf="parent" from second cardview like this
<android.support.v7.widget.CardView
android:id="#+id/card_topplayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/_5sdp"
android:elevation="#dimen/_8sdp"
app:cardCornerRadius="#dimen/_10sdp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toBottomOf="#+id/win_card"
>