Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] java – How can I add button at the bottom of the screen having a recycler View. so that the button don’t hide the last element of recycler view

Posted on November 11, 2022 By

Solution 1 :

Try this,

    <androidx.recyclerview.widget.RecyclerView
        android_id="@+id/menu_recycler_view"
        android_layout_width="match_parent"
        android_layout_height="match_parent"
        android_layout_above="@+id/bt_goto_cart"
        android_layout_below="@id/tv_menu_title"
        android_background="@color/white" />

Problem :

I want to add the button which will only be shown at when any item of recycler view is checked and hide it when uncheck.
The button should not hide the last element of recycler view.
I tried this code but when I make the button visible (by selecting an item of recycler view) and scroll to the bottom of the recycler view it overlap the last element.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.RestaurantMenuActivity">
    <RelativeLayout
        android_id="@+id/menu_header"
        android_layout_width="wrap_content"
        android_layout_height="wrap_content"
        android_background="@color/white"
        android_elevation="6dp">
        <LinearLayout
            android_id="@+id/header_ll_layout"
            android_layout_width="match_parent"
            android_layout_height="?attr/actionBarSize"
            android_orientation="horizontal">
            <TextView
                android_id="@+id/tv_restaurant_name"
                android_layout_width="wrap_content"
                android_layout_height="match_parent"
                android_layout_weight="8.2"
                android_gravity="center_vertical"
                android_paddingStart="20dp"
                android_paddingTop="10dp"
                android_paddingEnd="10dp"
                android_paddingBottom="6dp"
                android_text="Sample restaurant name"
                android_textColor="@color/Black"
                android_textSize="20sp"
                android_textStyle="bold" />
            <ImageView
                android_id="@+id/img_restaurant_fav"
                android_layout_width="45dp"
                android_layout_height="45dp"
                android_layout_gravity="center"
                android_layout_weight="1.8"
                android_padding="6dp"
                android_src="@drawable/ic_fav" />
        </LinearLayout>
        <TextView
            android_id="@+id/tv_menu_title"
            android_layout_width="wrap_content"
            android_layout_height="wrap_content"
            android_layout_below="@id/header_ll_layout"
            android_layout_alignParentStart="true"
            android_layout_marginStart="1dp"
            android_layout_marginTop="0dp"
            android_drawableStart="@drawable/ic_list"
            android_gravity="center_vertical"
            android_paddingStart="20dp"
            android_paddingTop="6dp"
            android_paddingEnd="16dp"
            android_paddingBottom="6dp"
            android_text="@string/menu"
            android_textColor="@color/Black"
            android_textSize="18sp"
            android_textStyle="bold" />
        <Button
            android_id="@+id/bt_goto_cart"
            android_layout_width="match_parent"
            android_layout_height="wrap_content"
            android_layout_alignParentBottom="true"
            android_backgroundTint="@color/green"
            android_gravity="center"
            android_paddingTop="3dp"
            android_paddingBottom="3dp"
            android_text="SampleGOTOcart"
            android_textColor="@color/white"
            android_textSize="15sp"
            android_visibility="invisible"
            tools_visibility="visible" />
        <androidx.recyclerview.widget.RecyclerView
            android_id="@+id/menu_recycler_view"
            android_layout_width="match_parent"
            android_layout_height="match_parent"
            android_layout_below="@id/tv_menu_title"
            android_background="@color/white" />
    </RelativeLayout>
</RelativeLayout>

Comments

Comment posted by Vijay

This works like perfectly for me only thing I need to do is keep the Button(bt_goto_cart) visibility to GONE.

READ  [FIXED] java - Android Spinner not showing selected text
Powered by Inline Related Posts
Android Tags:android, android-button, android-recyclerview, java

Post navigation

Previous Post: [FIXED] java – How to solve debug issue
Next Post: [FIXED] android – How to solve setting up this payment problem – paypal

Related Posts

[FIXED] Environment.getExternalStorageDirectory() deprecated. So how to access custom folders in internal storage in android API 29? Android
[FIXED] android – Changing color statements in Viewholder don’t work; only one statement works properly Android
[FIXED] android – RecyclerView reusing variables inside custom view Android
[FIXED] java – Firebase login user with custom username Android
[FIXED] java – How to move data from one activity to next activity (ListView) by clicking an add button? Android
[FIXED] java – Making a singleton have all static fields Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What is a good substitute for condensed milk?
  • ¿Como el cuerpo te avisa cuando te va a dar un infarto?
  • What is the luxury brand of Jaguar?
  • Who is Big poppa baseball player?
  • What material are foam runners?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme