My run time view is not matching with my design view.
my targeted is design .
but when I run on an android device. I got this
How do I overlap the Cardview on Image view?
Does it possible to accomplish. at first, I use FrameLayout then use Relative Layout Now I am out of my option.
Here is my design Code
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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"
android:fitsSystemWindows="true"
android:background="#color/grey_10"
android:clipChildren="false"
tools:context="com.kurtihouse.nirzonpop.detailspage.view.ProductDetailsActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="256dp"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="#style/TextAppearance.AppCompat.Title"
app:layout_scrollFlags="scroll"
app:titleEnabled="false">
<ImageView
android:id="#+id/ivProductImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
android:src="#drawable/image_8"
app:layout_collapseMode="pin" />
<!--<android.support.v7.widget.RecyclerView
android:id="#+id/rvProductImage"
android:layout_width="match_parent"
android:layout_height="#dimen/product_image_height"
android:layout_marginEnd="1dp"
android:contentDescription="#string/image_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#mipmap/ic_launcher" />-->
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/overlay_dark_40" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetStartWithNavigation="0dp"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:tint="#android:color/white"
app:srcCompat="#drawable/img_wizard_1" />
<!-- <View
android:layout_width="#dimen/spacing_middle"
android:layout_height="0dp" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nature Park"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Title"
android:textColor="#android:color/white" />-->
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/nested_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-50dp"
android:clipToPadding="false"
android:scrollbars="vertical"
android:scrollingCache="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/cardView"
style="#style/CardViewTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_anchorGravity=""
app:layout_constraintTop_toBottomOf="#+id/rvProductImage">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_share_gray" />
<ImageView
android:id="#+id/ivFavorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="#+id/imageView2"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_favorite_off" />
<LinearLayout
android:id="#+id/llDirectContract"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="#color/colorBgSuccess"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvProductCode">
<ImageView
android:id="#+id/ivCall111"
android:layout_width="#dimen/iv_call_width"
android:layout_height="#dimen/iv_call_height"
android:paddingTop="5dp"
app:srcCompat="#drawable/ic_phone" />
<TextView
android:id="#+id/tvDirectContractNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/padding_10"
android:text="#string/direct_buy"
android:textColor="#color/colorWhite"
android:textStyle="bold"
app:layout_constraintVertical_bias="0.0" />
</LinearLayout>
<TextView
android:id="#+id/tvPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text=""
android:textColor="#color/colorBlack"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/imageView2" />
<TextView
android:id="#+id/tvProductName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text=""
android:textColor="#color/colorBlack"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvPrice" />
<TextView
android:id="#+id/tvProductCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="swewewe"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tvProductName" />
<TextView
android:id="#+id/tvAvailability"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:background="#drawable/border_toast_success"
android:paddingStart="10dp"
android:paddingTop="3dp"
android:paddingEnd="10dp"
android:paddingBottom="3dp"
android:text="TextView"
android:textColor="#color/colorWhite"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/llDirectContract"
app:layout_constraintStart_toEndOf="#+id/llDirectContract"
app:layout_constraintTop_toTopOf="#+id/llDirectContract" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="#dimen/spacing_large" />
<android.support.v7.widget.CardView
android:id="#+id/sizeCardView"
style="#style/CardViewTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/cardView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp">
<TextView
android:id="#+id/tvSize"
style="#style/Text.SizeSection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="#string/lbl_size" />
<TextView
android:id="#+id/tv_sizeList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="dlkfjldsfjkldsjf" />
</LinearLayout>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="#dimen/spacing_large" />
<android.support.v7.widget.CardView
android:id="#+id/detailsCardView"
style="#style/CardViewTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:paddingBottom="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sizeCardView">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/descriptionLabel"
style="#style/Text.Description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Description"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="deesadefdsfdasfdsaf"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/descriptionLabel" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="#dimen/spacing_large" />
<Button
android:id="#+id/btnAddCart"
android:layout_width="#dimen/btn_add_cart_width"
android:layout_height="40dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="#drawable/round_button"
android:drawableStart="#drawable/ic_shopping_cart_white"
android:paddingStart="16dp"
android:text="#string/add_to_cart_label"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="22sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
This is happening because your appbarLayout have some elevation above the card view ! So use :-
app:elevation="0dp"
to your appBarLayout
Related
I am trying to make whatsapp like appbar
My Code
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="#+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="#drawable/abc_vector_test"
app:logo="#drawable/ic_baseline_edit_24"
app:subtitle="Me, You"
app:title="Group Name"
app:menu="#menu/chat_room_app_bar"
style="#style/Widget.MaterialComponents.Toolbar.Primary"
>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
The problem is that I am unable to combine display picture with navigationIcon like in whatsapp appbar
and also how to add ripple effect when we click on appbar shown below
This worked for me.
I have made the custom toolbar with imageView in it.
<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=".ui.chatroom.ChatRoomActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="#+id/topAppBar"
style="#style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:orientation="vertical"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:menu="#menu/chat_room_app_bar"
app:title="#null">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/navigationBackButtonChatRoom"
style="#style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_dp"
android:clickable="true">
<ImageView
android:id="#+id/chatRoomDisplayImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/abc_vector_test"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"
android:background="#null"
android:scaleType="fitXY"
android:src="#drawable/p_p"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/chatRoomDisplayImageView"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="#style/roundedImageViewRounded" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/chatInfoConstraintLayout"
style="#style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize"
android:layout_margin="0dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:minWidth="540dp">
<TextView
android:id="#+id/titleTextViewChatRoom"
style="#style/TextAppearance.Widget.AppCompat.Toolbar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:text="Group Name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/subtitleTextViewChatRoom"
style="#style/TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Me, You"
android:visibility="gone"
app:layout_constraintStart_toStartOf="#+id/titleTextViewChatRoom"
app:layout_constraintTop_toBottomOf="#+id/titleTextViewChatRoom" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/messageRecyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toTopOf="#+id/footerConstraintLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:itemCount="100"
tools:listitem="#layout/chat_row_left_head" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/footerConstraintLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<ImageButton
android:id="#+id/sendButtonMain"
android:layout_width="47dp"
android:layout_height="47dp"
android:layout_marginEnd="4dp"
android:background="#drawable/input_circle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/input_send" />
<LinearLayout
android:id="#+id/input_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/ib_new_round"
android:gravity="bottom"
android:minHeight="47dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/sendButtonMain"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp">
<ImageButton
android:id="#+id/emojiButtonChatRoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:background="#android:color/transparent"
android:src="#drawable/ib_emoji"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="#color/ibEmojiIconTint" />
<EditText
android:id="#+id/mainEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:autoText="true"
android:background="#null"
android:capitalize="sentences"
android:hint="Type a message"
android:imeOptions="actionSend"
android:maxLines="6"
android:paddingTop="4dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarDefaultDelayBeforeFade="200"
android:scrollbarFadeDuration="300"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
android:textColor="#color/primary_text"
android:textColorHint="#color/hint_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/attachButton"
app:layout_constraintStart_toEndOf="#+id/emojiButtonChatRoom"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/attachButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="14dp"
android:rotation="-45"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/cameraButton"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ib_attach" />
<ImageView
android:id="#+id/cameraButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="12dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_baseline_photo_camera_24" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/scrollToBottomFab"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="bottom|end"
android:layout_marginEnd="12dp"
android:layout_marginBottom="72dp"
android:clickable="true"
app:fabCustomSize="32dp"
app:maxImageSize="24dp"
app:srcCompat="#drawable/ic_baseline_keyboard_arrow_down_24" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
I want to remove white space that I show in picture
Picure
I draw red circle around white space on picture
and I want remove it
I search in stackoverflow but in that case i can not find any anwswer.
My main layout is -->
toolbar_normal.xml:
<?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"
tools:context=".MainActivity">
<include layout="#layout/city_detail_act"
android:id="#+id/content"/>
<android.support.v7.widget.Toolbar
android:id="#+id/tolbar_storyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#66cc66"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center"
android:orientation="horizontal"
tools:layout_editor_absoluteX="16dp">
<ImageView
android:id="#+id/imgSetting"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/setting" />
<ImageView
android:id="#+id/imgChoiceCity"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_marginStart="181dp"
android:layout_marginLeft="181dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="180dp"
android:layout_marginRight="180dp"
android:layout_marginBottom="3dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/choicecity" />
<ImageView
android:id="#+id/imageViewButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:adjustViewBounds="false"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/home" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>
</android.support.constraint.ConstraintLayout>
My second layout is -->
city_detail_act.xml:
<?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"
android:gravity="top"
android:paddingBottom="65dp"
>
<android.support.v7.widget.Toolbar
android:id="#+id/tolbar_story"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#66cc66"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center"
android:orientation="horizontal"
tools:layout_editor_absoluteX="16dp">
<ImageView
android:id="#+id/imgTooTitlelbarMainActf"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/adamak" />
<ImageView
android:id="#+id/imgTooTitlelbarMainAct"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="180dp"
android:layout_marginLeft="180dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="181dp"
android:layout_marginRight="181dp"
android:layout_marginBottom="3dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/title" />
<ImageView
android:id="#+id/imgNavigationView"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:adjustViewBounds="false"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/dot" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/tx_state6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textSize="15sp"
android:fontFamily="#font/adobearabicregular"
/>
<ImageView
android:id="#+id/imv_refresh2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tx_state6"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:padding="10px"
android:src="#drawable/refresh"
/>
<WebView
android:id="#+id/web2"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_below="#+id/imv_refresh2"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
>
</WebView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_marginBottom="12dp"
android:gravity="right"
android:orientation="horizontal">
<TextView
android:id="#+id/txMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/adobearabicbold"
android:text="مشاهده همه..."
android:textSize="12sp"
/>
<TextView
android:id="#+id/txYHinCityDetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:fontFamily="#font/adobearabicbold"
android:text="هر آنچه درمورد قم باید بدانید"
android:textSize="24sp" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rvListYH"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/rvListBazar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ProgressBar
android:id="#+id/progressBar66"
style="#android:style/Widget.Holo.ProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/rv_listcity"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:indeterminate="true"
android:visibility="gone" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
How can i do it work?
Thank you
Removing the following line parent tag in file city_detail_act.xml should fix it
android:paddingBottom="65dp"
And add these to your include tag
android:layout_width="match_parent"
android:layout_height="match_parent"
Also, consider using Bottom Nav layout for UI like this.
First remove this:
android:paddingBottom="65dp"
Then your include should be like this:
<include
android:id="#+id/content"
layout="#layout/city_detail_act"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#id/tolbar_storyButton"
app:layout_constraintTop_toTopOf="parent" />
I have a problem structuring my layout. I need to implement a BottomSheet Layout that hides under the actionbar, but I have implemented UINavigations Jetpack + BottomSheetNavigation in my Activity. AppBar is created manually, ie it is not the default actionbar of android.
In the current Fragment I am implementing CoordinatorLayout for such a solution, so far I was able to implement normally, but the bottomsheet expands only to the actionbar.
I wanted to hide the buttons that are visible in peek mode of the bottomsheet layout.
Follows prints and excerpts of the layout.
Activity layout
<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"
tools:context="br.com.wari.wariconsumo.newapp.presentation.ui.sale.SaleActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="#+id/ll_status_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
app:layout_scrollFlags="scroll|enterAlways"
android:orientation="horizontal">
<ImageView
android:id="#+id/iv_statusBar_nfcStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="#string/statusBar_nfc_status"
android:paddingEnd="5dp"
android:paddingStart="6dp"
android:src="#drawable/ic_circle"
android:tint="#color/color_green" />
<TextView
android:id="#+id/tv_statusBar_nfcType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:text="#string/statusBar_NFCtype"
android:textColor="#color/all_white" />
<TextView
android:id="#+id/tv_statusBar_batteryLevel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:layout_weight="1"
android:gravity="end"
android:lines="1"
android:text="#string/statusBar_battery_percentage"
android:textAlignment="gravity"
android:textColor="#color/all_white" />
</LinearLayout>
<androidx.appcompat.widget.Toolbar xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light"
local:theme="#style/WariTheme.ToolbarSearch"
app:layout_scrollFlags="scroll|enterAlways" />
</com.google.android.material.appbar.AppBarLayout>
<fragment
android:id="#+id/nav_host_sale"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="#+id/bottom_navigation_sale"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/appbar"
app:navGraph="#navigation/nav_graph_sale" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation_sale"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="#color/colorPrimary"
app:itemIconTint="#drawable/bottom_navigation_colors"
app:itemTextColor="#drawable/bottom_navigation_colors"
app:labelVisibilityMode="selected"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="#menu/menu_navigation_sale" />
</androidx.constraintlayout.widget.ConstraintLayout>
Fragment Host Layout
<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="br.com.wari.wariconsumo.newapp.presentation.ui.sale.fragments.menu.MenuFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/cl_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_products"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="#layout/layout_bottom_sheet_cart_products"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
layout bottom sheet
<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:id="#+id/ll_bottom_sheet_products"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible"
app:behavior_hideable="false"
app:behavior_peekHeight="150dp"
android:fitsSystemWindows="false"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<View
android:id="#+id/shadow"
android:layout_width="match_parent"
android:layout_height="6dp"
android:background="#drawable/shape_gradient_top_shadow"
app:layout_anchor="#id/ll_bottom_sheet" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="1dp"
app:cardElevation="20dp"
android:elevation="20dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/cl_bottom_sheet_cart"
android:background="#color/white_semi_transparent"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tv_amount_participant"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="32dp"
android:gravity="bottom"
android:text="#string/one_participant"
android:textAlignment="center"
android:textSize="16sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/tv_small_total_value"
app:layout_constraintEnd_toStartOf="#id/view_indicator_swipe"
app:layout_constraintStart_toStartOf="parent" />
<!-- <ImageButton-->
<!-- android:id="#+id/ib_indicator_swipe"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="center"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:background="#null"-->
<!-- android:paddingTop="4dp"-->
<!-- android:paddingBottom="4dp"-->
<!-- android:src="#drawable/ic_indicator_swipe"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<View android:id="#+id/view_indicator_swipe"
android:layout_width="30dp"
android:layout_height="5dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#drawable/swipe_up_handle"
android:src="#drawable/ic_indicator_swipe"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:id="#+id/tv_currency_symbol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="bottom"
android:text="R$ "
android:textSize="16sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#id/tv_small_total_value"
app:layout_constraintEnd_toStartOf="#id/tv_small_total_value"
app:layout_constraintTop_toTopOf="#id/tv_small_total_value" />
<TextView
android:id="#+id/tv_small_total_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="bottom"
android:text="0,00"
android:textSize="28sp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="#+id/ib_confirm"
app:layout_constraintTop_toBottomOf="#+id/view_indicator_swipe" />
<TextView
android:id="#+id/tv_title_total_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="#string/value_to_pay"
android:textAllCaps="true"
android:textColor="#color/text_normal"
android:textSize="16sp"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ib_participant_minus" />
<TextView
android:id="#+id/tv_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginEnd="4dp"
android:gravity="center"
android:text="#string/coin_real"
android:textColor="#color/text_normal"
android:textSize="16sp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="#+id/tv_large_total_value"
app:layout_constraintEnd_toStartOf="#+id/tv_large_total_value"
app:layout_constraintTop_toTopOf="#+id/tv_large_total_value" />
<TextView
android:id="#+id/tv_large_total_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="#string/currency_zero"
android:textColor="#color/text_dark"
android:textSize="56sp"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_title_total_value" />
<Button
android:id="#+id/ib_participant_minus"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="#drawable/bg_white_selector"
android:drawableTop="#drawable/ic_minus_user"
android:gravity="bottom"
android:paddingStart="4dp"
android:paddingTop="7dp"
android:paddingEnd="4dp"
android:paddingBottom="7dp"
android:tag="1"
android:text="#string/decrease"
android:textAlignment="center"
android:textColor="#color/text_normal"
android:textSize="8sp"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="#+id/ib_participant_plus"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_amount_participant"
tools:ignore="SmallSp" />
<Button
android:id="#+id/ib_participant_plus"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="#drawable/bg_white_selector"
android:drawableTop="#drawable/ic_plus_user"
android:gravity="bottom"
android:paddingStart="4dp"
android:paddingTop="7dp"
android:paddingEnd="4dp"
android:paddingBottom="7dp"
android:tag="12"
android:text="#string/increase"
android:textAlignment="center"
android:textColor="#color/text_normal"
android:textSize="8sp"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="#+id/ib_note"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ib_participant_minus"
app:layout_constraintTop_toTopOf="#+id/ib_participant_minus"
tools:ignore="SmallSp" />
<Button
android:id="#+id/ib_note"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="#drawable/bg_blue_selector"
android:drawableTop="#drawable/ic_message_outline"
android:gravity="bottom"
android:paddingStart="4dp"
android:paddingTop="7dp"
android:paddingEnd="4dp"
android:paddingBottom="7dp"
android:tag="13"
android:text="#string/note"
android:textAlignment="center"
android:textColor="#color/all_white"
android:textSize="8sp"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="#+id/ib_clear"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ib_participant_plus"
app:layout_constraintTop_toTopOf="#+id/ib_participant_plus"
tools:ignore="SmallSp" />
<Button
android:id="#+id/ib_clear"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="#drawable/bg_red_selector"
android:drawableTop="#drawable/ic_trash"
android:gravity="bottom"
android:paddingStart="4dp"
android:paddingTop="7dp"
android:paddingEnd="4dp"
android:paddingBottom="7dp"
android:text="#string/clear"
android:textAlignment="center"
android:textColor="#color/all_white"
android:textSize="8sp"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="#+id/ib_confirm"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ib_note"
app:layout_constraintTop_toTopOf="#+id/ib_note"
tools:ignore="SmallSp" />
<Button
android:id="#+id/ib_confirm"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:background="#drawable/bg_purple_selector"
android:drawableTop="#drawable/ic_check"
android:gravity="bottom"
android:paddingStart="4dp"
android:paddingTop="7dp"
android:paddingEnd="4dp"
android:paddingBottom="7dp"
android:tag="7"
android:text="#string/all_confirm"
android:textAlignment="center"
android:textColor="#color/all_white"
android:textSize="8sp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ib_clear"
app:layout_constraintTop_toTopOf="#+id/ib_clear"
tools:ignore="SmallSp" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_items_cart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="96dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_large_total_value" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
When first launch activity, the image not appear, but when u scroll, the image appear. I really confuse about this problem, please help. Is it because I'm using ConstraintLayout instead RecyclerView or LinearLayout?
Below is the XML code i use
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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=".InsideActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/collapsing_toolbar_appbarlayout"
android:layout_width="match_parent"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_height="200dp"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="#android:color/transparent"
android:fitsSystemWindows="true"
>
<ImageView
android:id="#+id/collapsing_toolbar_image_view"//this where i add image to toolbar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar //this where the toolbar asign
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView //Im using to this, to make it scrollable
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView 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"
app:cardCornerRadius="4dp">
<com.facebook.shimmer.ShimmerFrameLayout // this to make shimmer effect when loading
android:id="#+id/shimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:shimmer_clip_to_children="true"
app:shimmer_direction="left_to_right"
app:shimmer_shape="linear"
android:layout_alignParentLeft="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="#layout/placeholder_inside_item"></include>
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<android.support.constraint.ConstraintLayout 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">
<ImageView
android:id="#+id/image_penulis"
android:layout_width="60dp"
android:layout_height="57dp"
android:layout_marginLeft="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="18dp"
android:src="#mipmap/ic_launcher_round"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/text_judul" />
<TextView
android:id="#+id/text_penulis"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:text="TextView"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/image_penulis"
app:layout_constraintTop_toBottomOf="#+id/text_judul"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/text_tanggal_tulis"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="TextView"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="#+id/image_penulis"
app:layout_constraintTop_toBottomOf="#+id/text_penulis"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="#+id/image_thumbnail"
android:layout_width="0dp"
android:layout_height="200dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toTopOf="#+id/text_judul"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:layout_constraintVertical_chainStyle="packed"
android:visibility="invisible"/>
<TextView
android:id="#+id/text_judul"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="24dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textAppearance="#android:style/TextAppearance.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/image_thumbnail" />
<TextView
android:id="#+id/text_isi_berita"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:text="TextView"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/image_penulis" />
<Button
android:id="#+id/btn_comment"
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:background="#drawable/rounded_corner_button"
android:text="COMMENT"
android:textColor="#android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.51"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/text_isi_berita"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Below is the code in main activity :
Toolbar toolbar = (Toolbar)findViewById(R.id.collapsing_toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar!=null)
{
// Display home menu item.
actionBar.setDisplayHomeAsUpEnabled(true);
}
CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout)findViewById(R.id.collapsing_toolbar_layout);
collapsingToolbarLayout.setTitle("");
ImageView collapsingToolbarImageView = (ImageView)findViewById(R.id.collapsing_toolbar_image_view);
collapsingToolbarImageView.setImageResource(R.drawable.food);
I have followed all the solutions which could solve my problem, but the fact its not. Please help
Try this
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/collapsing_toolbar_appbarlayout"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="#+id/collapsing_toolbar_image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/kid"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.v7.widget.CardView 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"
app:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.facebook.shimmer.ShimmerFrameLayout
android:id="#+id/shimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:shimmer_clip_to_children="true"
app:shimmer_direction="left_to_right"
app:shimmer_shape="linear">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="#layout/placeholder_inside_item"></include>
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<android.support.constraint.ConstraintLayout 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">
<ImageView
android:id="#+id/image_penulis"
android:layout_width="60dp"
android:layout_height="57dp"
android:layout_marginLeft="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="18dp"
android:src="#mipmap/ic_launcher_round"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/text_judul" />
<TextView
android:id="#+id/text_penulis"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:text="TextView"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/image_penulis"
app:layout_constraintTop_toBottomOf="#+id/text_judul"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/text_tanggal_tulis"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="TextView"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="#+id/image_penulis"
app:layout_constraintTop_toBottomOf="#+id/text_penulis"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="#+id/image_thumbnail"
android:layout_width="0dp"
android:layout_height="200dp"
android:scaleType="fitXY"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="#+id/text_judul"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="#+id/text_judul"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="24dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textAppearance="#android:style/TextAppearance.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/image_thumbnail" />
<TextView
android:id="#+id/text_isi_berita"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:text="TextView"
android:textAppearance="#android:style/TextAppearance.Medium"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/image_penulis" />
<Button
android:id="#+id/btn_comment"
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:background="#drawable/rounded_corner_button"
android:text="COMMENT"
android:textColor="#android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.51"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/text_isi_berita"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
I have an Activity open multiple Fragments using using ViewPager and TabLayout. When I try to implement scroll for the fragment using NestedScrollView, I am not able to scroll all the way to the end of the fragment. Is there something missing or incorrect with this layout?
Activity Layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.design.widget.AppBarLayout
android:id="#+id/detail_app_bar"
android:layout_width="match_parent"
android:layout_height="240dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/detail_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="#color/colorPrimary"
app:expandedTitleMargin="#dimen/horizontal_margin"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/detail_photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:actualImageScaleType="focusCrop"
app:layout_collapseMode="parallax"
app:placeholderImageScaleType="centerInside"
app:viewAspectRatio="1.33"
fresco:placeholderImage="#drawable/empty_detail" />
<android.support.v7.widget.Toolbar
android:id="#+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetStart="#dimen/horizontal_margin"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/detail_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.design.widget.TabLayout
android:id="#+id/detail_tab_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="#color/colorAccent"
app:tabTextColor="#color/tertiaryText" />
</android.support.v4.view.ViewPager>
</android.support.design.widget.CoordinatorLayout>
Fragment Layout:
<android.support.v4.widget.NestedScrollView 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:fillViewport="true"
android:background="#color/White"
android:clipToPadding="false"
android:padding="16dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".UI.Details.DetailsActivity">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.constraint.Guideline
android:id="#+id/guideline"
android:layout_width="8dp"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
<TextView
android:id="#+id/current_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="TextView"
android:textSize="45sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/weather_condition_image"
android:layout_width="140dp"
android:layout_height="144dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:src="#drawable/ic_thunderstrom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/current_temp" />
<TextView
android:id="#+id/weather_condition_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:text="TextView"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weather_condition_image" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weather_condition_text">
<TextView
android:id="#+id/sunrise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sunrise" />
<TextView
android:id="#+id/sunrise_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5:00am"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.300"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toBottomOf="#+id/weather_condition_text">
<TextView
android:id="#+id/sunset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sunset" />
<TextView
android:id="#+id/sunset_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6:00pm"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout5"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout1">
<TextView
android:id="#+id/humidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/humidity" />
<TextView
android:id="#+id/humidity_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="83%"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.300"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toBottomOf="#+id/linearLayout2">
<TextView
android:id="#+id/wind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/wind" />
<TextView
android:id="#+id/wind_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5.1mph"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout3">
<TextView
android:id="#+id/min_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/temp_min" />
<TextView
android:id="#+id/min_temp_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="72"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.340"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toBottomOf="#+id/linearLayout4">
<TextView
android:id="#+id/max_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/temp_max" />
<TextView
android:id="#+id/max_temp_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="80"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>