Android scrollview hiding top widget in layout - android-studio

Let me tell you first, this is not duplicate question. I have tried every solution from stackoverflow. but nothing work for me.
in my Application, I implementing two gridlayout. first one scroll horizontal and second one scroll vertical. but the problem is when i add scrollview to the second Gridview it hide top content that is my texrview and imagview.
I don't understand. what I am doing wrong.
This is code:
<FrameLayout 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.home.HomeFragment">
<LinearLayout
android:orientation="vertical"
android:weightSum="10"
android:paddingTop="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/textGrid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:fontFamily="#font/quicksand_bold"
android:paddingStart="20dp"
android:text="Welcome"
android:textColor="#141D50"
android:textSize="34sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/search"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="150dp"
android:src="#android:drawable/ic_search_category_default"
app:tint="#141D50"
tools:ignore="UnknownId" />
</LinearLayout>
</RelativeLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="50dp">
<GridLayout
android:id="#+id/mainGrid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="8"
android:alignmentMode="alignMargins"
android:columnOrderPreserved="false"
android:numColumns="6"
android:padding="8dp"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="#color/colorPrimaryDark"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/street"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/dress"
app:tint="#android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="#+id/electricity"
android:layout_gravity="center"
android:fontFamily="#font/quicksand_bold"
android:paddingTop="10dp"
android:text="Dress"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="#color/colorPrimaryDark"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/other"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/bags"
app:tint="#android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="#+id/electricity"
android:layout_gravity="center"
android:fontFamily="#font/quicksand_bold"
android:paddingTop="5dp"
android:text="Bags"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="#color/colorPrimaryDark"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/other1"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/toys"
app:tint="#android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="#+id/electricity"
android:layout_gravity="center"
android:fontFamily="#font/quicksand_bold"
android:paddingTop="5dp"
android:text="Toys"
android:textAlignment="center"
android:textColor="#android:color/white"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</GridLayout>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_weight="1"
android:fillViewport="true"
android:focusableInTouchMode="true"
app:layout_constrainedHeight="true">
<GridLayout
android:id="#+id/mainGrid1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:alignmentMode="alignMargins"
android:columnCount="2"
android:columnOrderPreserved="false"
android:padding="14dp">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/electricity1"
android:layout_width="wrap_content"
android:layout_height="104dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/electricity"
android:layout_gravity="center"
android:text="water supply"
android:textAlignment="center"
android:textColor="#141D50"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/water1"
android:layout_width="wrap_content"
android:layout_height="104dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="water supply"
android:textAlignment="center"
android:textColor="#141D50"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/clean1"
android:layout_width="wrap_content"
android:layout_height="104dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Cleanliness"
android:textAlignment="center"
android:textColor="#141D50"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- Column 2 -->
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/street1"
android:layout_width="wrap_content"
android:layout_height="104dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Street"
android:textAlignment="center"
android:textColor="#141D50"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/m"
android:layout_width="wrap_content"
android:layout_height="104dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Other"
android:textAlignment="center"
android:textColor="#141D50"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_margin="16dp"
android:orientation="vertical">
<ImageView
android:id="#+id/m1"
android:layout_width="wrap_content"
android:layout_height="104dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Other"
android:textAlignment="center"
android:textColor="#141D50"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</GridLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>

It happens, because you written android:layout_weight="1" in RelativeLayout.
First of all, remove android:layout_weight="1" from your RelativeLayout.
Secondly, set RelativeLayout height as a wrap_content.
Before:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
After:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>

Related

App shows a different activity layout when launched for the first time

I'm sorry for the confusion for the title but this is what happens
This is what the app looks like and it works fine.
HOWEVER...
When the app is launched everytime it shows this.
For some weird reason the card view stretches. This only happens everytime you open the app. It goes back to normal when you tap on assessment then go back.
I don't know what to do because my xml codes is all working as intended on the first photo and I don't know what causes this problem.
CODE:
<TextView
android:id="#+id/title_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="12dp"
android:text=" "
android:textColor="#fff"
android:fontFamily="#font/ness"
android:textSize="30sp"
android:textStyle="bold" />
<TextView
android:id="#+id/title_view2"
android:layout_width="294dp"
android:layout_height="58dp"
android:layout_below="#+id/title_view"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="65dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="52dp"
android:layout_marginBottom="112dp"
android:fontFamily="#font/ness"
android:text="What do you want to do today?"
android:textAlignment="center"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/title_view"
android:layout_margin="100dp"
android:columnCount="2"
android:rowCount="3">
<androidx.cardview.widget.CardView
android:id="#+id/assess_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="0"
android:layout_rowWeight="1"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_gravity="fill"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/asses" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Assessment"
android:textAlignment="center"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/profile_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="1"
android:layout_rowWeight="1"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_gravity="fill"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/profile" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Profile"
android:textAlignment="center"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</GridLayout>
Do you need grid layout in this ui? And your android:columnCount="2" and android:rowCount="3" it's can be reason. Maybe you should use constraintlayout.
UPDATED
Try code below, maybe it can solve your problem.
Also I have seen you used RelativeLayout, for now day it's deprecated and google recommend to use constraintlayout.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/title_view2"
android:layout_width="294dp"
android:layout_height="58dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="#font/ness"
android:text="What do you want to do today?"
android:textAlignment="center"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="#+id/assess_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="#+id/title_view2"
app:layout_constraintStart_toStartOf="#+id/title_view2"
app:layout_constraintTop_toBottomOf="#+id/title_view2">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/asses" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Assessment"
android:textAlignment="center"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/profile_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill"
android:layout_marginTop="8dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="#+id/assess_menu"
app:layout_constraintStart_toStartOf="#+id/assess_menu"
app:layout_constraintTop_toBottomOf="#+id/assess_menu">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/profile" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Profile"
android:textAlignment="center"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

Android GridView: two colulmns of equal width and height centred in the parent

How can such a simple requirement be so impossible?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:layout_weight="1"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="18dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="1"
android:paddingLeft="12dp"
android:background="#drawable/box_background"
android:columnCount="2"
>
<TextView
android:layout_gravity="center"
android:padding="4dp"
android:text="text"
android:textSize="24dp"
/>
<TextView
android:layout_gravity="center"
android:padding="4dp"
android:text="text"
android:textSize="24dp"
/>
<TextView
android:layout_gravity="center"
android:padding="4dp"
android:text="text"
android:textSize="24dp"
/>
<TextView
android:layout_gravity="center"
android:padding="4dp"
android:text="text"
android:textSize="24dp"
/>
<TextView
android:layout_gravity="center"
android:padding="4dp"
android:text="text"
android:textSize="24dp"
/>
<TextView
android:layout_gravity="center"
android:padding="4dp"
android:text="text"
android:textSize="24dp"
/>
</GridLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:text="Box title" />
</RelativeLayout>
</LinearLayout>
Produces this rubbish:
WTF is the gap above the third row?
Is it possible -- I swear it isn't -- to get two centred columns with the rows evenly spaced?
Use this add android:layout_columnWeight="1" to gridlayout childrens
<?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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:layout_weight="1"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/grid_layout"
android:columnCount="2"
android:layout_below="#id/title"
android:orientation="horizontal"
android:useDefaultMargins="true"
android:alignmentMode="alignBounds"
>
<TextView
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:gravity="center"
android:text="text"
android:layout_columnWeight="1"
android:textSize="20sp"
/>
<TextView
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:gravity="center"
android:text="text"
android:layout_columnWeight="1"
android:textSize="20sp"
/>
<TextView
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:gravity="center"
android:text="text"
android:layout_columnWeight="1"
android:textSize="20sp"
/>
<TextView
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:gravity="center"
android:text="text"
android:layout_columnWeight="1"
android:textSize="20sp"
/>
<TextView
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:gravity="center"
android:text="text"
android:layout_columnWeight="1"
android:textSize="20sp"
/>
<TextView
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:gravity="center"
android:text="text"
android:layout_columnWeight="1"
android:textSize="20sp"
/>
</GridLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:paddingLeft="6dp"
android:id="#+id/title"
android:textSize="16sp"
android:paddingRight="6dp"
android:text="Box title" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
Output :

How do I remove the extra space in this recyclerview element in Android?

I'm implementing a Recycler View in Android to create a list, but for some reason I see a space in between two elements, and I'm not able to pinpoint the error location. As to why is this happening, my guess is on the row element XML.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cardview1="http://schemas.android.com/apk/res-auto"
android:id="#+id/row_top_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/pos_cv"
android:layout_width="match_parent"
android:layout_height="72dp"
android:clickable="true"
cardview1:cardCornerRadius="6dp"
cardview1:cardElevation="4dp"
cardview1:cardMaxElevation="6dp">
<TextView
android:id="#+id/manager1"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="15dp"
android:text="Store Manager/Branch"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal">
<TextView
android:id="#+id/retail"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:text="Abc Retail"
android:textSize="10sp" />
<View
android:layout_width="170dp"
android:layout_height="match_parent" />
<TextView
android:id="#+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="25,000"
android:textColor="#color/colorDarkPink"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="#+id/address"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="50dp"
android:text="Abc Retail"
android:textSize="10sp" />
</android.support.v7.widget.CardView>
RecyclerView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/list_view_header_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:weightSum="5"
android:background="#color/colorDarkPink"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Top 3 Performers"
android:textStyle="bold"
android:textColor="#color/colorPrimaryLight"
android:layout_weight="3"
android:textSize="16sp"
android:lines="1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sales"
android:textStyle="bold"
android:textColor="#color/colorPrimaryLight"
android:layout_weight="2"
android:textSize="16sp"
android:lines="1"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/performer_lv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#color/colorTransparent"
android:layout_marginTop="16dp"
android:dividerHeight="4dp"
/>
It is because of recycler view height. Try to change recyclerview height to wrap_content.And in cardview layout in linear-layout use height wrap_content.
try this code for your cardview:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cardview1="http://schemas.android.com/apk/res-auto"
android:id="#+id/row_top_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/pos_cv"
android:layout_width="match_parent"
android:layout_height="72dp"
android:clickable="true"
android:layout_marginBottom="10dp"
cardview1:cardCornerRadius="6dp"
cardview1:cardElevation="4dp"
cardview1:cardMaxElevation="6dp">
<TextView
android:id="#+id/manager1"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="15dp"
android:text="Store Manager/Branch"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal">
<TextView
android:id="#+id/retail"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:text="Abc Retail"
android:textSize="10sp" />
<View
android:layout_width="170dp"
android:layout_height="match_parent" />
<TextView
android:id="#+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="25,000"
android:textColor="#color/colorDarkPink"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="#+id/address"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="50dp"
android:text="Abc Retail"
android:textSize="10sp" />
</android.support.v7.widget.CardView>
</LinearLayout>
Try to decrease your values
android:layout_height="50dp"
if it will not work try to decrease values in other views

How to place static positioned button in a co-ordinator layout such that contents don't overlap?

I have created a co-ordinator layout which has an Appcompat button placed at the bottom. I also have a relative layout inside that co-ordinator layout which is inside a nested scroll view. Output I am getting is like the fixed button overlaps the contents of the relative layout which does not let some of the elements inside the relative layout to be viewed. Please help me out guys!
Regards,
Thanks.`
<?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:id="#+id/main_content"
android:clipToPadding="false"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".Hashmapretrieval"
app:contentScrim="#000000"
android:fitsSystemWindows="true"
app:statusBarBackground="#android:color/transparent"
android:background="#ffffff"
>
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fitsSystemWindows="true"
android:background="#000000"
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="#000000"
android:background="#000000"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:id="#+id/imagev"
android:background="#000000"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
android:minHeight="100dp"/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
</android.support.v7.widget.Toolbar>
</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:id="#+id/ns"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<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="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:id="#+id/rr1"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:background="#ffffff"
android:fitsSystemWindows="true"
android:layout_alignParentBottom="true"
android:paddingBottom="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:background="#ffffff">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text=""
android:textSize="15sp"
android:textColor="#000000"
android:id="#+id/placeid" />
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/rel1"
android:layout_height="0.3dp" android:background="#000000" android:layout_below="#+id/placeid" android:layout_marginTop="20dp">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rel3"
android:background="#ffffff"
android:layout_below="#+id/rel1"
android:layout_marginTop="10dp">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/tablelayout"
android:layout_marginTop="10dp"
android:background="#ffffff">
<TableRow android:id="#+id/tableRow1"
android:layout_height="0dp"
android:layout_width="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="17sp"
android:text="Teaching Skills"
android:id="#+id/QF"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No Ratings"
android:textSize="17sp"
android:id="#+id/rate1"
android:gravity="center"
android:padding="5dp"
android:layout_weight="0"
/>
</TableRow>
<TableRow android:id="#+id/tableRow2"
android:layout_height="0dp"
android:layout_width="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="17sp"
android:text="Classroom Culture"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
android:id="#+id/QS"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No Ratings"
android:textSize="17sp"
android:id="#+id/rate2"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow3"
android:layout_height="0dp"
android:layout_width="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="17sp"
android:text="Syllabus Covered"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
android:id="#+id/QT"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="No Ratings"
android:textSize="17sp"
android:id="#+id/rate3"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow4"
android:layout_height="0dp"
android:layout_width="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="17sp"
android:text="Extra help when needed"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
android:id="#+id/QFo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="No Ratings"
android:textSize="17sp"
android:id="#+id/rate4"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow5"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_gravity="center_vertical|center_horizontal|center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="17sp"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
android:text="Recommendations"
android:id="#+id/QFi"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="No Ratings"
android:textSize="17sp"
android:id="#+id/rate5"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0.3dp" android:background="#000000" android:layout_marginTop="10dp" android:layout_below="#+id/tr1">
</RelativeLayout>
<TableRow android:id="#+id/tableRow6"
android:layout_height="0dp"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="17sp"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
android:text="Overall Ratings"
android:id="#+id/Or"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="No Ratings"
android:textSize="17sp"
android:id="#+id/rateo"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0.3dp" android:background="#000000" android:layout_marginTop="10dp" android:layout_below="#+id/tr2">
</RelativeLayout>
<TableRow
android:layout_height="0dp"
android:layout_width="match_parent" android:padding="15dp"
> </TableRow>
<TableRow android:id="#+id/tableRow7"
android:layout_height="0dp"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Fees:"
android:textSize="17sp"
android:id="#+id/tv1"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:textSize="17sp"
android:id="#+id/fees"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow8"
android:layout_height="0dp"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Installment:"
android:textSize="17sp"
android:id="#+id/tv2"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="#+id/instavl"
android:layout_below="#+id/fees"
android:layout_weight="0"
android:gravity="center"
android:textSize="17sp"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow9"
android:layout_height="0dp"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Duration:"
android:id="#+id/tv3"
android:layout_weight="3"
android:textSize="17sp"
android:gravity="left"
android:padding="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="#+id/duration"
android:layout_weight="0"
android:textSize="17sp"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow10"
android:layout_height="0dp"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Group Discount:"
android:textSize="17sp"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:textSize="17sp"
android:id="#+id/groupdiscount"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
<TableRow android:id="#+id/tableRow11"
android:layout_height="0dp"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="One Time Discount:"
android:textSize="17sp"
android:id="#+id/tv5"
android:layout_weight="3"
android:gravity="left"
android:padding="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:textSize="17sp"
android:id="#+id/otpdiscount"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
/>
</TableRow>
</TableLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:id="#+id/rr3"
android:layout_below="#+id/tablelayout">
<Button android:id="#+id/add_wishlist"
android:layout_height="#dimen/buttonheight"
android:layout_width="match_parent"
android:onClick="addtowishlist"
android:textAllCaps="false"
android:textSize="#dimen/buttonTextsize"
android:text="Add to my List"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<Button android:id="#+id/book_demo"
android:onClick="bookdemo"
android:layout_height="40dp"
android:clickable="true"
android:layout_width="match_parent"
android:layout_gravity="end|bottom" android:textColor="#ffffff"
android:textSize="#dimen/buttonTextsize"
android:textAllCaps="false"
android:text="Come for Demo Lecture"
android:background="#3b3b3b"
/>
</android.support.design.widget.CoordinatorLayout>
To hide/show FloatingActionButton there are different ways (and examples online), I like the way through a Behavior i.e. like this.
If you dont want the usual overlap, you can try adding a margin bottom of x dp (the eight of the button) to the NestedScrollView by:
android:layout_marginBottom="xdp"

how to design responsive image button & layout by using android studio?

i am new to android development . I designed one parking app , but the layout is not responsive to all mobile devices.
I tried to make responsive image buttons by using 9patch png images & by taking different drawable folder(hdpi,mdpi,xhdpi) . But both are not working for large screen devices.
This is one sample xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background"
>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/exit"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:src="#drawable/exit1"
android:onClick="on_Bexit"
android:layout_alignTop="#+id/home0"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/home0"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:src="#drawable/home1"
android:onClick="on_Bhome0"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/car"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:src="#drawable/c4"
android:onClick="on_Bcar"
android:cropToPadding="true"
android:nestedScrollingEnabled="true"
android:layout_alignBottom="#+id/textView5"
android:layout_alignLeft="#+id/bike"
android:layout_alignStart="#+id/bike" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bike"
android:layout_gravity="center_vertical"
android:src="#drawable/b3"
android:background="#android:color/transparent"
android:onClick="on_Bbike"
android:layout_above="#+id/exit"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="ENTRY "
android:id="#+id/textView"
android:textColor="#8dacbe"
android:textStyle="bold"
android:textSize="35dp"
android:layout_above="#+id/car"
android:layout_toLeftOf="#+id/textView6"
android:layout_toStartOf="#+id/textView6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bike_count"
android:text="90"
android:textColor="#140441"
android:textSize="30dp"
android:textStyle="bold|italic"
android:layout_alignBottom="#+id/bike"
android:layout_toLeftOf="#+id/exit"
android:layout_toStartOf="#+id/exit"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/car_count"
android:text="120"
android:textStyle="bold|italic"
android:textColor="#140441"
android:textSize="30dp"
android:layout_alignBottom="#+id/car"
android:layout_alignRight="#+id/bike_count"
android:layout_alignEnd="#+id/bike_count" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView5"
android:visibility="invisible"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/T_areadis"
android:hint="Parking area id and name"
android:textColor="#8dacbe"
android:text="kharghar"
android:textSize="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="PAGE"
android:id="#+id/textView6"
android:textColor="#005384"
android:textSize="40dp"
android:textAlignment="center"
android:fontFamily="#string/abc_action_bar_home_description"
android:textStyle="bold"
android:layout_alignTop="#+id/textView"
android:layout_toRightOf="#+id/car_count"
android:layout_toEndOf="#+id/car_count" />
</RelativeLayout>
Please kindly help me out.
Large screen devices use xxhdpi.
How to has equal width
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/exit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bexit"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ENTRY "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#8dacbe"
android:textSize="35dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/home0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bhome0"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/bike_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="90"
android:textColor="#140441"
android:textSize="30dp"
android:textStyle="bold|italic" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/car"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bcar"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/car_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="120"
android:textColor="#140441"
android:textSize="30dp"
android:textStyle="bold|italic" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/bike"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bbike"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/T_areadis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Parking area id and name"
android:text="kharghar"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#8dacbe"
android:textSize="30dp" />
</LinearLayout>

Resources