Android ScrollView with custom scrolling from TextView1 to TextView2 - java

I have a huge vertical ScrollView which contains many TextViews and ShapableImageViews.
The standard ScrollView allows a smooth scrolling. But I want to have it like this in my app:
As soon as the user scrolls, there should be no smooth scrolling, but it should automatically scroll from TextView1 to TextView2. When the user scrolls down again, it should automatically scroll to TextView3. And when user scrolls up, it should go back from TextView3 to TextView2.
How do I achieve that custom scrolling behavior?
I use Kolin, but also a help with Java code would be very appreciated.
This is my XML:
<?xml version="1.0" encoding="utf-8"?>
<layout
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">
<data>
<variable
name="isData"
type="com.example.ezworkshop.TutorialData" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".view.TutorialActivity"
android:background="#25261D">
<ScrollView
android:id="#+id/scrollView_activityTutorial"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/linearLayout"
android:orientation="vertical"
android:gravity="start"
android:layout_gravity="start"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="15dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/image"
android:scaleType="fitXY"
android:layout_marginTop="11dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:imageUrl="#{isData.image}"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="#+id/iv_playButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="#drawable/playbutton"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="#+id/tutorialHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#{isData.tutorialHeading}"
android:textColor="#color/standardTextColor"
android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tutorialText"
android:text="#{isData.tutorialText}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/tutorialText2"
android:text="#{isData.tutorialText2}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText3"
android:text="#{isData.tutorialText3}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage2"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage2}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText4"
android:text="#{isData.tutorialText4}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage3"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage3}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText5"
android:text="#{isData.tutorialText5}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage4"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage4}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText6"
android:text="#{isData.tutorialText6}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage5"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage5}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText7"
android:text="#{isData.tutorialText7}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage6"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage6}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText8"
android:text="#{isData.tutorialText8}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage7"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage7}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText9"
android:text="#{isData.tutorialText9}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage8"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage8}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText10"
android:text="#{isData.tutorialText10}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage9"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage9}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText11"
android:text="#{isData.tutorialText11}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage10"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage10}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText12"
android:text="#{isData.tutorialText12}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage11"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage11}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText13"
android:text="#{isData.tutorialText13}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage12"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage12}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText14"
android:text="#{isData.tutorialText14}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage13"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage13}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText15"
android:text="#{isData.tutorialText15}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage14"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage14}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText16"
android:text="#{isData.tutorialText16}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage15"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage15}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText17"
android:text="#{isData.tutorialText17}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage16"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage16}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText18"
android:text="#{isData.tutorialText18}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage17"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage17}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText19"
android:text="#{isData.tutorialText19}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage18"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage18}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
<TextView
android:id="#+id/tutorialText20"
android:text="#{isData.tutorialText20}"
android:textSize="22sp"
android:gravity="start"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#color/standardTextColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/tutorialTextImage19"
android:scaleType="fitXY"
android:imageUrl="#{isData.tutorialTextImage19}"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_width="match_parent"
android:layout_height="220dp"
app:shapeAppearanceOverlay="#style/RoundCornerForImageView"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
</layout>

Related

XML Layout Material Card View border not showing

So I made a layout with Frame Layout and Scroll View. There are 3 material card view inside scroll view. But I dont know why the third card border is not showing and sometimes only the bottom border is missing. I think is because of the constraint and scroll view but I still cant solve it. Anyone knows?
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
>
<com.google.android.material.card.MaterialCardView
android:id="#+id/cv_item_info"
android:layout_width="match_parent"
android:layout_height="100dp"
android:backgroundTint="#color/white"
app:cardCornerRadius="20dp"
app:cardElevation="2dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/tv_item_nama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/nama_item"
android:textColorHint="#color/black"
android:fontFamily="#font/poppins_medium"
android:text=""
android:textStyle="bold"
android:textSize="14sp"
android:textColor="#color/black"
android:maxLines="1"
android:ellipsize="end"/>
<TextView
android:id="#+id/tv_item_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:hint="#string/category_item"
android:text=""
android:fontFamily="#font/poppins"
android:textSize="11sp"
android:maxLines="1"
android:ellipsize="end"/>
<TextView
android:id="#+id/tv_item_harga"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:hint="#string/harga_item"
android:textColorHint="#color/black"
android:text=""
android:fontFamily="#font/poppins"
android:textSize="14sp"
android:textColor="#color/black"
android:maxLines="1"
android:ellipsize="end" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="#+id/cv_seller_profile"
android:layout_width="match_parent"
android:layout_height="100dp"
android:backgroundTint="#color/white"
app:cardCornerRadius="20dp"
app:cardElevation="2dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
app:layout_constraintTop_toBottomOf="#id/cv_item_info"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp">
<androidx.cardview.widget.CardView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
app:cardCornerRadius="20dp">
<ImageView
android:id="#+id/iv_seller_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#mipmap/ic_launcher"
android:contentDescription="#string/seller_picture" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tv_seller_nama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:fontFamily="#font/poppins_medium"
android:textStyle="bold"
android:textColor="#color/black"
android:text=""
android:textSize="14sp"
android:hint="#string/seller_name"
android:textColorHint="#color/black"/>
<TextView
android:id="#+id/tv_seller_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:textSize="11sp"
android:text=""
android:fontFamily="#font/poppins"
android:hint="#string/seller_city"/>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="#+id/cv_item_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/white"
app:cardCornerRadius="20dp"
app:cardElevation="2dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
app:layout_constraintTop_toBottomOf="#id/cv_seller_profile"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/deskripsi"
android:fontFamily="#font/poppins_medium"
android:textColorHint="#color/black"
android:textStyle="bold"
android:textSize="14sp"
android:textColor="#color/black"
android:text=""/>
<TextView
android:id="#+id/tv_deskripsi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Test"
android:fontFamily="#font/poppins"
android:textSize="14sp"
android:textColor="#color/black" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
Here is the example image of the layout I made.
ImageLayout
It happens because you do not have a bottom constraint on your last card.
Add a constraint there, and your card will be displayed correctly

How to add a scroll view in an Android app

I want to add scroll in my XML without editing the following code. Is there any way of adding it in the following XML? I tried by adding Scroll view and then linear view but it makes the view cut. Is there any way of making it better, I have searched other repository but I didn't find a solution.
<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=".Activity.BookSeatsActivity"
android:orientation="vertical"
android:weightSum="12"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:weightSum="5"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/wheel"
android:src="#drawable/mywheel"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="17dp"
/>
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/grid"
android:layout_marginTop="10dp"
android:layout_below="#+id/wheel"
android:padding="1dp"
android:numColumns="5"
/>
</RelativeLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".4"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".6"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:weightSum="3"
android:layout_marginEnd="10dp"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/seat_open"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:text="Available"
android:paddingStart="5dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/seat_booked"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:text="Unavailable"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/seat_selected"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:paddingStart="5dp"
android:gravity="center_vertical"
android:text="Selected"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:orientation="horizontal"
android:layout_marginStart="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Seat Selected : "
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:textColor="#android:color/black"
android:textStyle="bold"
android:fontFamily="#font/montserrat_regular"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tv_seat_selected"
android:textStyle="bold"
android:textColor="#android:color/black"
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:gravity="center_vertical"
android:layout_marginTop="10dp"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="0dp"
android:layout_weight="1"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/bt_booking_details"
android:textStyle="bold"
android:textColor="#android:color/white"
android:textSize="17dp"
android:layout_margin="10dp"
android:text="Enter Booking Details"
android:fontFamily="#font/montserrat_regular"
android:background="#drawable/circular_button"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Please use the below code snippet for the XML file and change the image view as per your needs.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="12"
tools:context=".MainActivity">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_weight="8"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:weightSum="5">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="3">
<ImageView
android:id="#+id/wheel"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="17dp"
android:layout_marginRight="17dp"
android:src="#drawable/sports" />
<GridView
android:id="#+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/wheel"
android:layout_marginTop="10dp"
android:numColumns="5"
android:padding="1dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".4" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_weight=".6"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/toys" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:text="Available" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/mobile" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:text="Unavailable" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/home" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:text="Selected" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:padding="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:text="Seat Selected : "
android:textColor="#android:color/black"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_seat_selected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:padding="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:textColor="#android:color/black"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_weight="1">
<Button
android:id="#+id/bt_booking_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Enter Booking Details"
android:textColor="#android:color/white"
android:textSize="17dp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Please try the following code, I just changed the scroll view to be match_parent for width and height and the linear layout to be match_parent for width& wrap_content for height.
Please note that this view won't scroll till you run it on a small screen device.
and please change the images as you need.
<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"
android:orientation="vertical"
android:weightSum="12">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:weightSum="5"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/wheel"
android:src="#drawable/ic_launcher_background"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="17dp"
/>
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/grid"
android:layout_marginTop="10dp"
android:layout_below="#+id/wheel"
android:padding="1dp"
android:numColumns="5"
/>
</RelativeLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".4"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".6"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:weightSum="3"
android:layout_marginEnd="10dp"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/ic_launcher_background"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:text="Available"
android:paddingStart="5dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/ic_launcher_background"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:text="Unavailable"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/ic_launcher_background"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:paddingStart="5dp"
android:gravity="center_vertical"
android:text="Selected"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:orientation="horizontal"
android:layout_marginStart="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Seat Selected : "
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:textColor="#android:color/black"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tv_seat_selected"
android:textStyle="bold"
android:textColor="#android:color/black"
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:gravity="center_vertical"
android:layout_marginTop="10dp"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="0dp"
android:layout_weight="1"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/bt_booking_details"
android:textStyle="bold"
android:textColor="#android:color/white"
android:textSize="17dp"
android:layout_margin="10dp"
android:text="Enter Booking Details"
android:background="#drawable/ic_launcher_background"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

Make whole layout that contains ListView scrollable

I have a LinearLayout that contains ListView. When the ListView is scrolled, the LinearLayout should scroll too.
But now when ListView is scrolled, the RelativeLayout above ListView not scrollable. Instead they always show on top! I tried to add ScrollView in LinearLayout, but get java.lang.IllegalStateException: ScrollView can host only one direct child
Here is what I have tried
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
style="?android:attr/buttonStyleSmall"
android:clickable="true"
android:id="#+id/relativeLayout1"
android:background="#drawable/boarder_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_marginTop="12dp"
android:textSize="15sp"
android:textColor="#color/darkGreen"
android:layout_marginLeft="8dp"
android:id="#+id/editTextDate"
android:background="#android:color/transparent"
android:layout_toRightOf="#+id/imgProfilePicture"
android:text="Post a new update"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:padding="8dp"
android:src="#drawable/images"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:id="#+id/imgProfilePicture"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"/>
</RelativeLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RelativeLayout
style="?android:attr/buttonStyleSmall"
android:id="#+id/relativeLayout2"
android:clickable="true"
android:layout_weight="0.5"
android:background="#drawable/boarder_layout"
android:layout_marginLeft="10dp"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:textColor="#color/darkGreen"
android:layout_marginTop="10dp"
android:layout_marginLeft="8dp"
android:id="#+id/txtView1"
android:background="#android:color/transparent"
android:layout_toRightOf="#+id/imgFindSomething"
android:text="I need something"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:tint="#color/limegreen"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/find_something"
android:id="#+id/imgFindSomething"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"/>
</RelativeLayout>
<RelativeLayout
style="?android:attr/buttonStyleSmall"
android:id="#+id/relativeLayout3"
android:clickable="true"
android:layout_marginRight="10dp"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:background="#drawable/boarder_layout"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:textColor="#color/crimson"
android:layout_marginTop="10dp"
android:layout_marginLeft="8dp"
android:id="#+id/txtView2"
android:layout_width="wrap_content"
android:background="#android:color/transparent"
android:layout_toRightOf="#+id/imgInvite"
android:text="Invite neighbours"
android:layout_height="wrap_content"/>
<ImageView
android:tint="#color/limegreen"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/add_neighbours"
android:id="#+id/imgInvite"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"/>
</RelativeLayout>
</LinearLayout>
<ListView android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:id="#+id/listView">
</ListView>
</LinearLayout>
You need to use a NestedScrollView like so:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never"
android:clipToPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
style="?android:attr/buttonStyleSmall"
android:clickable="true"
android:id="#+id/relativeLayout1"
android:background="#drawable/boarder_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_marginTop="12dp"
android:textSize="15sp"
android:textColor="#color/darkGreen"
android:layout_marginLeft="8dp"
android:id="#+id/editTextDate"
android:background="#android:color/transparent"
android:layout_toRightOf="#+id/imgProfilePicture"
android:text="Post a new update"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:padding="8dp"
android:src="#drawable/images"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:id="#+id/imgProfilePicture"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RelativeLayout
style="?android:attr/buttonStyleSmall"
android:id="#+id/relativeLayout2"
android:clickable="true"
android:layout_weight="0.5"
android:background="#drawable/boarder_layout"
android:layout_marginLeft="10dp"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:textColor="#color/darkGreen"
android:layout_marginTop="10dp"
android:layout_marginLeft="8dp"
android:id="#+id/txtView1"
android:background="#android:color/transparent"
android:layout_toRightOf="#+id/imgFindSomething"
android:text="I need something"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:tint="#color/limegreen"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/find_something"
android:id="#+id/imgFindSomething"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"/>
</RelativeLayout>
<RelativeLayout
style="?android:attr/buttonStyleSmall"
android:id="#+id/relativeLayout3"
android:clickable="true"
android:layout_marginRight="10dp"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:background="#drawable/boarder_layout"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:textColor="#color/crimson"
android:layout_marginTop="10dp"
android:layout_marginLeft="8dp"
android:id="#+id/txtView2"
android:layout_width="wrap_content"
android:background="#android:color/transparent"
android:layout_toRightOf="#+id/imgInvite"
android:text="Invite neighbours"
android:layout_height="wrap_content"/>
<ImageView
android:tint="#color/limegreen"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/add_neighbours"
android:id="#+id/imgInvite"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"/>
</RelativeLayout>
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:id="#+id/listView">
</ListView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
I would also suggest replacing your ListView with a RecyclerView for better performance.
Use this code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/primary"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/boarder_layout"
android:clickable="true">
<TextView
android:id="#+id/editTextDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="12dp"
android:layout_toRightOf="#+id/imgProfilePicture"
android:background="#android:color/transparent"
android:padding="10dp"
android:text="Post a new update"
android:textColor="#color/darkGreen"
android:textSize="15sp" />
<ImageView
android:id="#+id/imgProfilePicture"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:padding="8dp"
android:src="#drawable/images" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/relativeLayout2"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:background="#drawable/boarder_layout"
android:clickable="true">
<TextView
android:id="#+id/txtView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/imgFindSomething"
android:background="#android:color/transparent"
android:text="I need something"
android:textColor="#color/darkGreen" />
<ImageView
android:id="#+id/imgFindSomething"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/find_something"
android:tint="#color/limegreen" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout3"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0.5"
android:background="#drawable/boarder_layout"
android:clickable="true">
<TextView
android:id="#+id/txtView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/imgInvite"
android:background="#android:color/transparent"
android:text="Invite neighbours"
android:textColor="#color/crimson" />
<ImageView
android:id="#+id/imgInvite"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/add_neighbours"
android:tint="#color/limegreen" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"></ListView>
</LinearLayout>

How to move buttons to bottom of screen?

Before I recently updated Android Studio, I had the buttons aligned to the bottom of the screen. Whenever I try to use android:layout:_alignParentBottom inside of a relative layout that layout param apparently does not exist now.
The left is how it looked before and the right is how it looks now
Main Activity XML code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="vertical"
tools:context="techercise.onerepmaxcalculator.MainActivity">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/bannerAd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
ads:adSize="BANNER"
ads:adUnitId="#+id/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center"
android:text="#string/Formulas"
android:textColor="#EEFF41"
android:textSize="48sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/textView3"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="#android:color/darker_gray"/>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView3"
android:layout_centerHorizontal="true"
android:layout_margin="24dp"
android:textAlignment="center"
android:textColor="#00C853"
android:textSize="44sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:text="#string/weight"
android:textColor="#000000"
android:textSize="24sp" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:ems="2"
android:inputType="number"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:text="#string/reps"
android:textColor="#000000"
android:textSize="24sp" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:ems="2"
android:inputType="number"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="#+id/button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="buttonSubmit"
android:text="#string/submitBtnText"
android:textColor="#00C853"
android:textSize="16sp" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="clearSubmit"
android:text="#string/clearBtnText"
android:textColor="#F44336"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
Use RelativeLayout instead of ScrollView if you don't have a view hierarchy that can be scrolled.
A ScrollView is a FrameLayout, meaning you should place one child in
it containing the entire contents to scroll;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="vertical"
tools:context="techercise.onerepmaxcalculator.MainActivity">
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/bannerAd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
ads:adSize="BANNER"
ads:adUnitId="#+id/banner_ad_unit_id"></com.google.android.gms.ads.AdView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center"
android:text="#string/Formulas"
android:textColor="#EEFF41"
android:textSize="48sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/textView3"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="#android:color/darker_gray" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView3"
android:layout_centerHorizontal="true"
android:layout_margin="24dp"
android:textAlignment="center"
android:textColor="#00C853"
android:textSize="44sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:text="#string/weight"
android:textColor="#000000"
android:textSize="24sp" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:ems="2"
android:inputType="number"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:text="#string/reps"
android:textColor="#000000"
android:textSize="24sp" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:ems="2"
android:inputType="number"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="buttonSubmit"
android:text="#string/submitBtnText"
android:textColor="#00C853"
android:textSize="16sp" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="clearSubmit"
android:text="#string/clearBtnText"
android:textColor="#F44336"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
Note:
- To move the layout when keyboard comes up, add the following attribute to your activity inside AndroidManifest.xml file:
android:windowSoftInputMode="adjustResize"
you can layout like that:
RelativeLayout in overall
ScrollView for your contents Layout
(LinearLayout, RelativeLayout...) at the bottom button
<?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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/scrollView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:background="#color/COLOR_BG_MENU_PARENT_DEFAULT"
android:orientation="vertical" />
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center"
android:orientation="horizontal"
android:id="#+id/llButton"
android:background="#color/COLOR_CHART_BLUE"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:text="Button 02" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:text="Button 01" />
</LinearLayout>
Here is the correct code: I removed the ScrollView completely.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<com.google.android.gms.ads.AdView
android:id="#+id/bannerAd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-8808093751237190/1348767274">
</com.google.android.gms.ads.AdView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/bannerAd"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center"
android:text="#string/Formulas"
android:textColor="#EEFF41"
android:textSize="48sp"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/textView3"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="#android:color/darker_gray">
</View>
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView3"
android:layout_centerHorizontal="true"
android:layout_margin="24dp"
android:textAlignment="center"
android:textColor="#00C853"
android:textSize="44sp"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:text="#string/weight"
android:textColor="#000000"
android:textSize="24sp"/>
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:ems="2"
android:inputType="number"
android:textColor="#000000"
android:textSize="24sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:text="#string/reps"
android:textColor="#000000"
android:textSize="24sp"/>
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:ems="2"
android:inputType="number"
android:textColor="#000000"
android:textSize="24sp"/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<Button
android:id="#+id/button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="buttonSubmit"
android:text="#string/submitBtnText"
android:textColor="#00C853"
android:textSize="16sp"/>
<Button
android:id="#+id/button2"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="clearSubmit"
android:text="#string/clearBtnText"
android:textColor="#F44336"
android:textSize="16sp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

How can I get this interface?

I'm debutant in android and I want to get an interface like this but I couldn't place my linearlayout interface
I tried to use a horizontal and a vertical linearlayout but it doesn't work
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"><TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:id="#+id/txt1"
android:text="AAAAAAAA"/><Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BE"
android:id="#+id/button1"/></LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:gravity="bottom">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:id="#+id/txt2"
android:text="RRRRRRR"/><LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:id="#+id/txt3"
android:text="JJJJJJJJJJ"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GO"
android:id="#+id/button2"/>
</LinearLayout>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:id="#+id/button3"/>
</LinearLayout>
Can you help me to correct this code?
Try this code.Hope this helps you.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center_horizontal">
<TextView
android:id="#+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="AAAAAAAA"
android:textSize="22sp" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_horizontal"
android:text="RRRRRRR"
android:textSize="22sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/txt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="JJJJJJJJJJ"
android:textSize="22sp" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GO" />
</LinearLayout>
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
android:layout_gravity="center_horizontal"
android:text="Start" />
</LinearLayout>
you can try this use RelativeLayout
<?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:orientation="vertical">
<TextView
android:id="#+id/txt1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="AAAAAAAA"
android:textSize="22sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/myl1"
android:gravity="center"
android:text="123465" />
<LinearLayout
android:id="#id/myl1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/button3"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="123465" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_weight="1"
android:text="Start" />
</LinearLayout>
<Button
android:id="#+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Start" />
</RelativeLayout>

Categories

Resources