I am facing very strange problem, though I am beginner level on Android. after designed my layout file, when i run this android project by using physical device then i actually not find expected UI.
Here is the Layout UI and it's XML code:-
Design:-
XML 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.DetailedActivity">
<ImageView
android:id="#+id/detailed_img"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="#drawable/ic_launcher_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.Toolbar
android:id="#+id/detailed_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="Product Detailed" />
<androidx.cardview.widget.CardView
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:elevation="10dp"
android:translationY="-50dp"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/detailed_img">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/detailed_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/amethysta"
android:text="Product Name"
android:textColor="#color/black"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:id="#+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_toStartOf="#id/my_rating"
android:fontFamily="#font/amethysta"
android:text="4.0"
android:textColor="#color/black"
android:textSize="16sp" />
<RatingBar
android:id="#+id/my_rating"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:isIndicator="true"
android:numStars="5"
android:stepSize="0.1" />
</RelativeLayout>
<TextView
android:id="#+id/detailed_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="#font/amethysta"
android:text="am following the standard example of how to add a RatingBar. To con The problem is that the number of stars doesn't seem to do anything a" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:fontFamily="#font/amethysta"
android:text="Price"
android:textColor="#color/black"
android:textSize="21sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/amethysta"
android:text="$"
android:textColor="#color/purple_700"
android:textStyle="bold" />
<TextView
android:id="#+id/detailed_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/amethysta"
android:text="20"
android:textColor="#color/purple_700"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="#+id/add_item"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:src="#drawable/plusicon" />
<TextView
android:id="#+id/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/remove_item"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:src="#drawable/iconminus" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="#+id/add_to_cart"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:backgroundTint="#color/pink"
android:drawableLeft="#drawable/mycart"
android:drawableTint="#color/white"
android:padding="14dp"
android:text="Add To Cart"
android:textAllCaps="false"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/buy_now"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/cardview"
app:layout_constraintVertical_bias="1"
app:layout_constraintWidth_percent=".8" />
<Button
android:id="#+id/buy_now"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_baseline_shopping_cart_24"
android:drawableTint="#color/white"
android:padding="14dp"
android:text="Buy Now"
android:textAllCaps="false"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent=".8" />
</androidx.constraintlayout.widget.ConstraintLayout>
And this is my physical devices unexpected output:-
I don't understand why this output act like that and which is totally unexpected. how I resolve this issue.
Since your CardView is not constrained by the buttons at the bottom the CardView will take space beyond those buttons. In the screenshot provided from a real device, it is clear that there is not much space to completely accommodate the contents in the CardView hence it will be pushed beyond the button. You need to add constraints to CardView to align it with the bottom button also you need to add a ScrollView if there is more content that the screen can't fully accommodate. Using this layout may improve the UI
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.DetailedActivity">
<ImageView
android:id="#+id/detailed_img"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="#drawable/ic_launcher_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.Toolbar
android:id="#+id/detailed_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="Product Detailed" />
<androidx.cardview.widget.CardView
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:elevation="10dp"
android:translationY="-50dp"
app:cardCornerRadius="10dp"
app:layout_constraintBottom_toTopOf="#+id/add_to_cart"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/detailed_img">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/detailed_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/amethysta"
android:text="Product Name"
android:textColor="#color/black"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:id="#+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_toStartOf="#id/my_rating"
android:fontFamily="#font/amethysta"
android:text="4.0"
android:textColor="#color/black"
android:textSize="16sp" />
<RatingBar
android:id="#+id/my_rating"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:isIndicator="true"
android:numStars="5"
android:stepSize="0.1" />
</RelativeLayout>
<TextView
android:id="#+id/detailed_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="#font/amethysta"
android:text="am following the standard example of how to add a RatingBar. To con The problem is that the number of stars doesn't seem to do anything a" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:fontFamily="#font/amethysta"
android:text="Price"
android:textColor="#color/black"
android:textSize="21sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/amethysta"
android:text="$"
android:textColor="#color/purple_700"
android:textStyle="bold" />
<TextView
android:id="#+id/detailed_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/amethysta"
android:text="20"
android:textColor="#color/purple_700"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="#+id/add_item"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:src="#drawable/plusicon" />
<TextView
android:id="#+id/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/remove_item"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:src="#drawable/iconminus" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.cardview.widget.CardView>
<Button
android:id="#+id/add_to_cart"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:backgroundTint="#color/pink"
android:drawableLeft="#drawable/mycart"
android:drawableTint="#color/white"
android:padding="14dp"
android:text="Add To Cart"
android:textAllCaps="false"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/buy_now"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent=".8" />
<Button
android:id="#+id/buy_now"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_baseline_shopping_cart_24"
android:drawableTint="#color/white"
android:padding="14dp"
android:text="Buy Now"
android:textAllCaps="false"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent=".8" />
</androidx.constraintlayout.widget.ConstraintLayout>
Related
I have a custom XML file for the options menu which I want to display underneath an ImageButton when it is clicked. I want to be able to get the id (or a name, index...) of the item from the menu when the item is selected.
Here's the XML file of recycler_view_item.xml which is the layout with the ImageButton that's supposed to show the menu on click:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:layout_marginBottom="55dp"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_anchorGravity="center_horizontal">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="0dp"
app:cardBackgroundColor="#182A3E"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="382dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="0dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:background="#drawable/recycler_item_background"
android:orientation="horizontal">
<TextView
android:id="#+id/tv_item_title"
android:layout_width="200dp"
android:layout_height="43dp"
android:layout_gravity="center_horizontal"
android:layout_marginStart="90dp"
android:layout_marginEnd="0dp"
android:gravity="center|center_horizontal"
android:text="Placeholder"
android:textColor="#F9F9F9"
android:textSize="20sp" />
<ImageButton
android:id="#+id/optionsMenuButton"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:paddingLeft="20dp"
android:paddingTop="3dp"
android:paddingRight="20dp"
app:srcCompat="#drawable/ic_options_menu_icon" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/subRecyclerView"
android:layout_width="356dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
Here's the XML file of options_menu_view.xml, which is the menu I want to display on click of the optionsMenuButton from the code above:
<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/optionsMenu"
android:layout_width="190dp"
android:layout_height="118dp"
android:layout_gravity="center_horizontal"
android:background="#drawable/ic_options_menu_background"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/addSubitem"
android:layout_width="match_parent"
android:layout_height="39dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="#drawable/ic_add_subitem_icon" />
<TextView
android:id="#+id/addItemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="46dp"
android:layout_marginTop="11dp"
android:fontFamily="#font/segoe_regular"
android:text="Add Item"
android:textColor="#EBEBEB"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="172dp"
android:layout_height="1dp"
android:layout_gravity="center_horizontal"
android:background="#drawable/options_menu_divider" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/editGroup"
android:layout_width="match_parent"
android:layout_height="39dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="#drawable/ic_edit_group_icon" />
<TextView
android:id="#+id/editGroupText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="46dp"
android:layout_marginTop="11dp"
android:fontFamily="#font/segoe_regular"
android:text="Edit Group"
android:textColor="#EBEBEB"
android:textSize="17sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="172dp"
android:layout_height="1dp"
android:layout_gravity="center_horizontal"
android:background="#drawable/options_menu_divider" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/deleteGroup"
android:layout_width="match_parent"
android:layout_height="39dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_delete_group_icon" />
<TextView
android:id="#+id/deleteGroupText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="46dp"
android:layout_marginTop="9dp"
android:fontFamily="#font/segoe_regular"
android:text="Delete Group"
android:textColor="#C93434"
android:textSize="17sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
What I would like it to look like when displayed:
Option Menu Example
I've been trying to find the solution for quite some time, but I'm quite new and to be honest, I don't even know what exactly I'm supposed to be searching for. Your help is greatly appreciated and sorry if this was posted in the past.
Thank you in advance.
I have a screen with four EditTexts, any edittext doesn't open the keyboard when I click on it. I'm not using an AVD, I'm using my own device, and tested in others devices and same result.My app has some activities like Login , sigup, home activity. In login and sigup activity edittext works correctly but in fragments of home activity keyboard is not opening.
XML
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="100dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="210dp"
android:background="#color/global_bg"
android:padding="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerVertical="true"
android:src="#drawable/profile"
app:civ_border_color="#color/main_color"
app:civ_border_width="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/profile_image"
android:orientation="vertical">
<TextView
android:id="#+id/fullname_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/bungee"
android:includeFontPadding="false"
android:text="Muneeb Ur Rehman"
android:textColor="#color/black"
android:textSize="19sp" />
<TextView
android:id="#+id/city_field_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/profile_image"
android:includeFontPadding="false"
android:text="user_city"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-80dp"
android:padding="20dp">
<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="125dp"
android:layout_margin="10dp"
android:layout_weight="1"
app:cardBackgroundColor="#color/main_color"
app:cardElevation="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerHorizontal="true"
android:background="#drawable/total_orders"
android:backgroundTint="#color/white" />
<TextView
android:id="#+id/totalOrders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/bungee"
android:includeFontPadding="false"
android:text="12"
android:textColor="#color/white"
android:textSize="20sp" />
<TextView
android:id="#+id/total_orders_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/totalOrders"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:includeFontPadding="false"
android:text="Total Orders"
android:textColor="#color/white"
android:textSize="18sp" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="125dp"
android:layout_margin="10dp"
android:layout_weight="1"
app:cardBackgroundColor="#color/main_color"
app:cardElevation="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerHorizontal="true"
android:background="#drawable/pending_orders"
android:backgroundTint="#color/white" />
<TextView
android:id="#+id/pendingOrders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/bungee"
android:includeFontPadding="false"
android:text="0"
android:textColor="#color/white"
android:textSize="20sp" />
<TextView
android:id="#+id/pendingOrders_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/pendingOrders"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:includeFontPadding="false"
android:text="Pending Orders"
android:textColor="#color/white"
android:textSize="18sp" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="19dp"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_person_black_24dp"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="Name"
android:inputType="textPersonName"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_baseline_phone_iphone_24"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="Mobile Number"
android:inputType="phone"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_baseline_location_city_24"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="City"
android:inputType="text"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_baseline_location_on_24"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="Address"
android:inputType="text"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<Button
android:id="#+id/btnUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#drawable/bg_btn"
android:fontFamily="#font/bungee"
android:text="UPDATE"
app:backgroundTint="#color/main_color" />
<Button
android:id="#+id/btnLogout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#drawable/bg_btn"
android:fontFamily="#font/bungee"
android:text="Logout"
app:backgroundTint="#color/main_color" />
</LinearLayout>
</LinearLayout>
</ScrollView>
```
Try using editText.setShowSoftInputOnFocus(true) and editText.setFocusable(true)
Also check your AndoridManifest.xml and add android:windowSoftInputMode="stateAlwaysVisible" to corresponding activity, or adjustResize.
<activity
android:name="com.fortrun.testcrashlytics.MainActivity"
android:windowSoftInputMode="adjustResize" >
</activity>
"adjustResize" The activity's main window is always resized to make
room for the soft keyboard on screen.
"stateAlwaysVisible" The soft keyboard is visible when the window receives input focus.
I have buttons what I made with "LinearLayout" but when I want to made them clickable and so that it goes to another activity. I understand, that I need to change from "LinearLayout" to "ImageButton" because I want to make a beautiful app [what I want it looks like][1], but when I launch it, it stops working. What can I do to repair that? Thank you in advance for your help and sorry for my bad english. :(
<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/colorBackground"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/layoutHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_background"
android:padding="20dp"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/textHello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="#string/hello"
android:textColor="#color/colorWhite"
android:textSize="25sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="TextContrastCheck" />
<TextView
android:id="#+id/textUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="#string/vassili"
android:textColor="#color/colorWhite"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="#id/textHello"
tools:ignore="TextContrastCheck" />
<ImageView
android:id="#+id/imageMenu"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_menu"
app:layout_constraintBottom_toBottomOf="#id/textHello"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#id/textHello"
app:tint="#color/colorWhite"
tools:ignore="ImageContrastCheck" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:overScrollMode="never"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/layoutHeader"
app:layout_constraintVertical_bias="0.0"
tools:layout_editor_absoluteX="-96dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/layoutGoal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:background="#drawable/white_background_icons"
android:gravity="center"
android:orientation="vertical"
android:padding="15dp"
app:layout_constraintDimensionRatio="H, 1:1"
app:layout_constraintEnd_toStartOf="#id/layoutTraining"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="8dp"
android:contentDescription="#string/app_name"
android:padding="8dp"
android:src="#drawable/notepad" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/goals"
android:textColor="#color/colorAccent"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/layoutTraining"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:background="#drawable/white_background_icons"
android:gravity="center"
android:orientation="vertical"
android:padding="15dp"
app:layout_constraintDimensionRatio="H, 1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/layoutGoal"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="8dp"
android:contentDescription="#string/app_name"
android:padding="8dp"
android:src="#drawable/dumbbell" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/Trainings"
android:textColor="#color/colorAccent"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/layoutWater"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:background="#drawable/white_background_icons"
android:gravity="center"
android:orientation="vertical"
android:padding="15dp"
app:layout_constraintDimensionRatio="H, 1:1"
app:layout_constraintEnd_toStartOf="#id/layoutTraining"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/layoutGoal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="8dp"
android:contentDescription="#string/app_name"
android:padding="8dp"
android:src="#drawable/bottle" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/Water"
android:textColor="#color/colorAccent"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/layoutStepCounter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:background="#drawable/white_background_icons"
android:gravity="center"
android:orientation="vertical"
android:padding="15dp"
app:layout_constraintDimensionRatio="H, 1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/layoutGoal"
app:layout_constraintTop_toBottomOf="#id/layoutTraining"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="8dp"
android:contentDescription="#string/app_name"
android:padding="8dp"
android:src="#drawable/walk" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/step_counter"
android:textColor="#color/colorAccent"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
[1]: https://i.stack.imgur.com/WdW6v.png
May you need to change constraintlayout to LinearLayout and if you want click be on image add id to imageview
For this type of layout you need to make your LinearLayout clickable
For example:
LinearLayout linearLayoutGoals;
then in you onCreate do findViewById and set its clickListener
linearLayoutGoals = findViewById(R.id.layoutGoal);
linearLayoutGoals.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//DO YOUR CODE
}
});
Currently, my scrollview could only scroll the bottom part of the screen. However though, I want the scrollview to be able to scroll the entire screen like how you would be able to normally and smoothly scroll an entire screen within an app. But i can't figure out what went wrong where for me as only i could scroll the bottom portion of the screen.Could anyone advise me on how? Thanks
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context=".SettingsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:animateLayoutChanges="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/rellay1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/grad"
android:paddingBottom="20dp">
<RelativeLayout
android:id="#+id/imgUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:background="#drawable/circle_border">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_margin="9dp"
android:adjustViewBounds="true"
android:background="#drawable/circle"
android:padding="3dp"
android:scaleType="centerInside"
android:src="#drawable/ic_user" />
</RelativeLayout>
<TextView
android:id="#+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imgUser"
android:layout_centerHorizontal="true"
android:layout_marginTop="15sp"
android:fontFamily="sans-serif-light"
android:text="Joey Tribbiani"
android:textColor="#color/white"
android:textSize="32sp" />
<TextView
android:id="#+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_name"
android:layout_centerHorizontal="true"
android:fontFamily="sans-serif"
android:text="new york, usa"
android:textAllCaps="true"
android:textColor="#color/address"
android:textSize="14sp" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/followersBg"
android:gravity="center"
android:layout_marginTop="250dp"
android:id="#+id/Rl1"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="80">
<TextView
android:id="#+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:text="My Order"
android:textColor="#color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="19dp"
tools:layout_conversion_absoluteWidth="58dp" />
<ImageView
android:id="#+id/ivWallet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginLeft="35dp"
android:layout_marginTop="45dp"
android:src="#drawable/ic_baseline_account_balance_wallet_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="24dp"
tools:layout_conversion_absoluteWidth="24dp" />
<TextView
android:id="#+id/tvTitleToBePaid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginLeft="17dp"
android:layout_marginTop="8dp"
android:text="To be Paid"
android:textColor="#color/white"
android:textSize="13dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ivWallet"
tools:layout_conversion_absoluteHeight="19dp"
tools:layout_conversion_absoluteWidth="66dp" />
<ImageView
android:id="#+id/ivBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="75dp"
android:layout_marginLeft="75dp"
android:layout_marginTop="45dp"
android:src="#drawable/ic_baseline_tobedelivered_24"
app:layout_constraintStart_toEndOf="#+id/ivWallet"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="24dp"
tools:layout_conversion_absoluteWidth="24dp" />
<TextView
android:id="#+id/tvTobeDelivered"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="8dp"
android:text="To be Delivered"
android:textColor="#color/white"
android:textSize="13dp"
app:layout_constraintStart_toEndOf="#+id/tvTitleToBePaid"
app:layout_constraintTop_toBottomOf="#+id/ivBox" />
<ImageView
android:id="#+id/ivBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="76dp"
android:layout_marginLeft="76dp"
android:layout_marginTop="44dp"
android:src="#drawable/ic_baseline_tobereceived_24"
app:layout_constraintStart_toEndOf="#+id/ivBox"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="24dp"
tools:layout_conversion_absoluteWidth="24dp" />
<TextView
android:id="#+id/tvTobeReceived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="8dp"
android:text="To be Received"
android:textColor="#color/white"
android:textSize="13dp"
app:layout_constraintStart_toEndOf="#+id/tvTobeDelivered"
app:layout_constraintTop_toBottomOf="#+id/ivBox2" />
<ImageView
android:id="#+id/ivThumbs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="90dp"
android:layout_marginLeft="90dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:src="#drawable/ic_baseline_tobeevaluated_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/ivBox2"
app:layout_constraintTop_toTopOf="parent"
tools:layout_conversion_absoluteHeight="24dp"
tools:layout_conversion_absoluteWidth="24dp" />
<TextView
android:id="#+id/tvTobeEvaluated"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginLeft="18dp"
android:layout_marginTop="8dp"
android:textSize="13dp"
android:text="To be Evaluated"
android:textColor="#color/white"
app:layout_constraintStart_toEndOf="#+id/tvTobeReceived"
app:layout_constraintTop_toBottomOf="#+id/ivBox2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
<TextView
android:id="#+id/TvRecommendation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recommended"
android:layout_marginTop="25dp"
android:layout_centerHorizontal="true"
android:layout_below="#+id/Rl1"/>
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/GvRecommendations"
android:layout_below="#+id/TvRecommendation"
android:numColumns="2"
android:verticalSpacing="5dp"
/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I think your layout is too unnecessary complicated. The highest RelativeLayout does nothing here. Make ScrollView your root view and set it's width and height to match parent.
Try it:
<androidx.core.widget.NestedScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent">
...
</androidx.core.widget.NestedScrollView>
Also You can try to set "android:layout_height="match_parent">" for ScrollView and set "android:layout_height="wrap_content">" for its child layout.
I am trying since 2 days ago to create this simple layout: it is not exactly equal, but it is near that what I want.
When I try to set the scrollView on my constraint layout I get always this messy
even if I constraint all my elements, I don't know how to organize the things at the moment, I am really confused about this.
here is my xml:
<ScrollView 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="wrap_content"
tools:context=".PhotosForPlant">
<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="com.example.afcosta.inesctec.pt.android.PhotosForPlant"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<ImageView
android:id="#+id/plantImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/color_cursor_white"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="41dp" />
<TextView
android:id="#+id/descricaoTit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Descrição"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="582dp" />
<TextView
android:id="#+id/specieDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
tools:layout_editor_absoluteX="4dp"
tools:layout_editor_absoluteY="622dp" />
<TextView
android:id="#+id/Family"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Familia"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="458dp" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Genre"
tools:layout_editor_absoluteX="24dp"
tools:layout_editor_absoluteY="389dp" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Espécie"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="309dp" />
<TextView
android:id="#+id/FamilyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="96dp"
tools:layout_editor_absoluteY="458dp" />
<TextView
android:id="#+id/GenreName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="96dp"
tools:layout_editor_absoluteY="389dp" />
<TextView
android:id="#+id/SpecieName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="96dp"
tools:layout_editor_absoluteY="309dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/gallery"
android:layout_width="408dp"
android:layout_height="111dp"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="141dp" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
As per your requirement i created sample layout so you can design same according to that i used nestedscrollview rather than scrollview and also applied constraint for all views
<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:fillViewport="true"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.afcosta.inesctec.pt.android.PhotosForPlant"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<ImageView
android:id="#+id/plantImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/smile"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintHorizontal_bias="0.573"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/toolbar2" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViLeft"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/plantImage"
android:layout_marginStart="8dp" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewDetail1"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="#+id/textView3"
android:layout_marginStart="8dp" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewDetail2"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/textView13" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewDetail3"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/textView14" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/plantImage"
android:layout_marginEnd="8dp" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewBold1"
android:textStyle="bold"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="#+id/textView3"
app:layout_constraintLeft_toRightOf="#+id/textView5"
android:layout_marginStart="20dp" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewBold2"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="#+id/textView6"
android:layout_marginStart="20dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/textView13" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewBold3"
app:layout_constraintLeft_toRightOf="#+id/textView7"
android:textStyle="bold"
android:layout_marginStart="20dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/textView14" />
<TextView
android:id="#+id/textView16"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="TextView TextView TextView TextView TextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintHorizontal_bias="0.0"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/textView15" />
<android.support.v7.widget.RecyclerView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:id="#+id/recyclerview"
app:layout_constraintTop_toBottomOf="#+id/textView16"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:layout_editor_absoluteX="8dp" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
here is design and blue print
NOTE: You are using RecyclerView in ScrollView which is not recommended.