mercredi 4 août 2021

Android I can't put anything at the bottom when using NestedScrollView

I am using android studio. Code java. I'm trying to place an ad at the bottom of the page. But I can't put anything at the bottom of the page when using NestedScrollView. How can I place the AdView at the bottom of the page? It should not be on top of the RecyclerView when scrolling the page. I want it to be below the RecyclerView when scrolling the page.

My design:

<?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"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    tools:context=".PostActivity"
    android:background="@color/colorarkaplanbeyaz"
    tools:showIn="@layout/activity_post_floating"
    android:layout_height="match_parent">



    <LinearLayout
        android:id="@+id/postlnl"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">



        <android.support.v7.widget.Toolbar
            android:id="@+id/appbarpost"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:popupTheme="@style/AppTheme.PopupOverlay" >

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/anıback"
                    android:background="@drawable/backmavi"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:visibility="visible"
                    android:layout_alignParentStart="true"
                    android:layout_centerInParent="true"
                    android:layout_alignParentLeft="true" />


                <TextView
                    android:textStyle="bold"
                    android:layout_marginLeft="30dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@+id/anıback"
                    android:textSize="20dp"
                    android:layout_centerInParent="true"
                    android:textColor="@color/baslikyazilari"
                    android:text="Post" />

                <ImageView
                    android:id="@+id/konutakipstar"
                    android:visibility="gone"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:layout_alignParentEnd="true"
                    android:layout_marginRight="10dp"
                    android:src="@drawable/starr"
                    android:layout_alignParentRight="true" />



                <ImageView
                    android:id="@+id/trashpost"
                    android:visibility="invisible"
                    android:layout_width="30dp"
                    android:layout_centerInParent="true"
                    android:layout_marginRight="10dp"
                    android:layout_alignParentEnd="true"
                    android:src="@drawable/trashpost"
                    android:layout_height="30dp"
                    android:layout_alignParentRight="true" />



            </RelativeLayout>



        </android.support.v7.widget.Toolbar>





        <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="10dp">



            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <com.google.android.gms.ads.AdView
                    android:id="@+id/adView5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_alignParentBottom="true"
                    ads:adSize="BANNER"
                    ads:adUnitId="ca-app-pub-8930855666602930/6535451162">

                </com.google.android.gms.ads.AdView>

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <TextView
                        android:textColor="@color/cardtextbegen"
                        android:textSize="11dp"
                        android:id="@+id/tvtpostkategori"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                    <TextView
                        android:textColor="@color/cardtextbegen"
                        android:id="@+id/tvtpostdate"
                        android:layout_width="match_parent"
                        android:gravity="right"
                        android:textSize="12dp"
                        android:layout_marginRight="5dp"
                        android:layout_marginBottom="3dp"
                        android:layout_height="wrap_content"
                        android:text="*" />


                </RelativeLayout>



                <TextView
                    android:textColor="@color/cardtextanı"
                    android:id="@+id/tvttitle"
                    android:textStyle="bold"
                    android:textSize="20dp"
                    android:text="*"
                    android:layout_marginRight="10dp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <TextView
                    android:textColor="@color/cardtextbegen"
                    android:id="@+id/tvtcontextt"
                    android:textSize="18dp"
                    android:layout_marginRight="10dp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="*"/>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="10dp"
                    android:orientation="horizontal">

                    <ImageView
                        android:padding="3dp"
                        android:id="@+id/like_buton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:src="@drawable/happyface" />

                    <TextView
                        android:textColor="@color/cardtextbegen"
                        android:id="@+id/display_no_of_likes"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0"
                        android:textSize="15sp" />

                    <ImageView
                        android:layout_marginLeft="10dp"
                        android:id="@+id/commentımagesend"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_gravity="center"
                        android:padding="3dp"
                        android:src="@drawable/commentbtn" />

                    <TextView
                        android:textColor="@color/cardtextbegen"
                        android:id="@+id/txt_commentyaz"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0 "
                        android:textSize="15sp"
                        android:textStyle="italic" />

                    <ImageView
                        android:visibility="gone"
                        android:padding="10dp"
                        android:id="@+id/ımagespeech"
                        android:layout_gravity="center"
                        android:layout_marginLeft="15dp"
                        android:src="@drawable/speech"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                    <RelativeLayout
                        android:layout_gravity="center"
                        android:layout_marginLeft="5dp"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:id="@+id/postpremiumuser"
                            android:visibility="gone"
                            android:layout_toLeftOf="@+id/tvtpostname"
                            android:src="@drawable/tac20p"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:layout_marginLeft="2dp"
                            android:layout_alignParentEnd="true"
                            android:ellipsize="end"
                            android:maxLines="1"
                            android:id="@+id/tvtpostname"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="right"
                            android:textColor="@color/baslikyazilari"
                            android:textStyle="bold|italic"
                            android:textSize="15dp"
                            android:text="*"
                            android:layout_alignParentRight="true" />



                    </RelativeLayout>





                </LinearLayout>

                <LinearLayout

                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">


                    <TextView
                        android:visibility="gone"
                        android:id="@+id/textcomment"
                        android:textColor="@color/anasayfaflocolor"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:text="Yorumlar:"
                        android:textSize="20sp"
                        android:textStyle="bold" />

                    <Button
                        android:id="@+id/btnyorumgöster"
                        android:layout_marginTop="30dp"
                        android:layout_gravity="center"
                        android:padding="10dp"
                        android:textColor="@color/anasayfaflocolor"
                        android:background="@drawable/buton_yorumgoster"
                        android:textAllCaps="false"
                        android:text="* "
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                    <ProgressBar
                        android:id="@+id/progresyorumgöster"
                        android:layout_gravity="center"
                        android:visibility="gone"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/recyclerviewcomment"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_below="@id/textcomment"
                        android:layout_margin="5dp">

                    </android.support.v7.widget.RecyclerView>



                </LinearLayout>


                <com.google.android.gms.ads.AdView
                    android:layout_gravity="center"
                    android:visibility="visible"
                    android:id="@+id/adViewpost2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_alignParentBottom="true"
                    ads:adSize="BANNER"
                    ads:adUnitId="ca-app-pub-8930855666602930/6535451162">

                </com.google.android.gms.ads.AdView>



            </LinearLayout>







        </android.support.v4.widget.NestedScrollView>










    </LinearLayout>




</RelativeLayout>

Appearance: enter image description here

Aucun commentaire:

Enregistrer un commentaire