Layout cut at the bottom in ScrollView - android

I have a ScrollView in my app and inside it I have created a Linear Layout which contains various elements but the problem is this my buttons on bottom are not displayed properly. They are cut off at bottom. I have used padding and margin but nothing has been happened. Below is my layout
<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"
android:background="#color/light_gray">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/dp10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/dp20"
android:layout_marginRight="#dimen/dp20"
android:layout_marginTop="#dimen/dp30"
android:orientation="vertical">
<ImageView
android:id="#+id/imgArticleImage"
android:layout_width="match_parent"
android:layout_height="#dimen/dp140"
android:layout_marginBottom="#dimen/dp15"
android:background="#android:color/white"
android:scaleType="fitXY"
android:src="#drawable/banner" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg_grey_border_white_bg">
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/dp5"
android:text="#string/title"
android:textColor="#android:color/black" />
<android.support.design.widget.TextInputLayout
android:id="#+id/ettxtLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/txtTitle"
android:padding="#dimen/dp5"
app:counterEnabled="true"
app:counterMaxLength="100"
app:counterTextAppearance="#style/TextLimitStyle">
<android.support.design.widget.TextInputEditText
android:id="#+id/etTitile"
android:layout_width="match_parent"
android:layout_height="#dimen/dp80"
android:background="#android:color/transparent"
android:gravity="top"
android:maxLength="100" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/dp20"
android:background="#drawable/bg_grey_border_white_bg">
<TextView
android:id="#+id/txtTitleDes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/dp5"
android:text="#string/start_writing"
android:textColor="#android:color/black" />
<android.support.design.widget.TextInputLayout
android:id="#+id/ettxtLayoutDes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/txtTitleDes"
android:padding="#dimen/dp5"
app:counterEnabled="true"
app:counterMaxLength="1200"
app:counterTextAppearance="#style/TextLimitStyle">
<android.support.design.widget.TextInputEditText
android:id="#+id/etDescription"
android:layout_width="match_parent"
android:layout_height="#dimen/dp140"
android:background="#android:color/transparent"
android:gravity="top"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/layNew"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="#dimen/dp10"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/btnSave_draft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dp10"
android:layout_marginRight="#dimen/dp20"
android:background="#android:color/holo_blue_light"
android:paddingLeft="#dimen/dp10"
android:paddingRight="#dimen/dp10"
android:text="#string/save_draft"
android:textColor="#android:color/white" />
<Button
android:id="#+id/btnPublish_article"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="#android:color/holo_blue_light"
android:paddingLeft="#dimen/dp10"
android:paddingRight="#dimen/dp10"
android:text="#string/publish_your_article"
android:textColor="#android:color/white"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/layUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="#dimen/dp10"
android:gravity="center"
android:orientation="horizontal"
>
<Button
android:id="#+id/btnDiscardChanges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/dp10"
android:layout_marginRight="#dimen/dp20"
android:background="#android:color/holo_blue_light"
android:paddingLeft="#dimen/dp10"
android:paddingRight="#dimen/dp10"
android:text="#string/discard_changes"
android:textColor="#android:color/white" />
<Button
android:id="#+id/btnSaveChanges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="#android:color/holo_blue_light"
android:paddingLeft="#dimen/dp10"
android:paddingRight="#dimen/dp10"
android:text="#string/save_changes"
android:textColor="#android:color/white"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<ProgressBar
android:id="#+id/pBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
`
Can anyone suggest me what I have missed?

Wrap up another LinearLayout under the ScrollView and give
paddingBottom to the Second child (the second LinearLayout)
so add this to the added linearLayout :-
android:paddingBottom="20dp"
Correct order for padding :-
ScrollView
||
LinearLayout X- X -- > padding Bottom wont be applied
||
LinearLayout with paddingBottom -- > is applicable
Note :- paddingBottom and marginBottom cannot be applied to the immediate child of the ScrollView.

Remove
android:paddingBottom="#dimen/dp10"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/dp10">

Just add android:paddingBottom="#dimen/dp30" into your LinearLayout:
<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"
android:background="#color/light_gray">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/dp10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/dp20"
android:layout_marginRight="#dimen/dp20"
android:layout_marginTop="#dimen/dp30"
android:orientation="vertical"
android:paddingBottom="#dimen/dp30">

Related

How to set this XML Android layout so that the text scrolls but the buttons still show?

I have the following layout consisting of several text boxes which I want to scroll as one object. I then have a linear layout below that which contains navigation buttons - I want this to stick to the bottom of the screen and not scroll.
Right now the bottom linear layout is pushed off the screen - I suspect because of the setting of the height of the scroll view. However I can't see the trick to resolve this. How can I make it so that the buttons in the linear view are always visible and stick to the bottom of the screen (not the bottom of the scrollview)?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
tools:context="com.QuestionView">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<ScrollView
android:id="#+id/ScrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:scrollbars="horizontal">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/questionText"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerA"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerB"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerC"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerD"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#ff9933"
android:text="Back" />
<Button
android:id="#+id/flip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#1a75ff"
android:text="Flip" />
<Button
android:id="#+id/next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#ff9933"
android:text="Next" />
</LinearLayout>
</LinearLayout>
Use a RelativeLayout for the outer layout. Define the Linear layout with buttons to be layout_alignParentBottom. Make the ScrollView layout_above the button layout and layout_below the toolbar (which should be alignParentTop). Then the buttons will be on the bottom, the toolbar on top, and the scroll view between them.
Best way to do this is to use android.support.design.widget.CoordinatorLayout to get Button Layout at bottom use android:layout_gravity="bottom" like below
Step 1:
Add compile 'com.android.support:design:26.1.0'
step 2:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.QuestionView">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/questionText"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerA"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerB"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerC"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
<TextView
android:id="#+id/answerD"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
android:text="TextView"
android:textSize="24dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal">
<Button
android:id="#+id/back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#ff9933"
android:text="Back" />
<Button
android:id="#+id/flip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#1a75ff"
android:text="Flip" />
<Button
android:id="#+id/next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#ff9933"
android:text="Next" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

LinearLayout to right of FrameLayout

I'm trying to place a linear layout to the right side of a frame layout.
This is the following code in my layout to set them next to each other:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ArmgaSys.ConDoc.Droid.Views.DrawingImageView
android:id="#+id/plan_markup_image"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<SkiaSharp.Views.Android.SKCanvasView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/plan_markup_canvas" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="bottom">
<TextView
android:id="#+id/planMarkupMessage"
android:text="Touch and drag to"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:textColor="#000000"
android:textAlignment="center"
android:gravity="center" />
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="match_parent"
android:background="#888888">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is my text"/>
</LinearLayout>
However, the linear layout does not appear, I believe it is being forced off the screen.
I have tried different combinations of wrap_content and match_parent for various view width/heights but things just aren't working. I have also tried putting the linear layout inside (but at the end of) the frame layout, which worked but it ended up cutting off the edge of the 'ArmgaSys.ConDoc.Droid.Views.DrawingImageView' component.
What do I need to do to get the frame layout and linear layout next to each other so that nothing overlaps or goes off the screen?
Edit
Here is the full layout 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="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<include
layout="#layout/widget_toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ArmgaSys.ConDoc.Droid.Views.UIColoredSpinner
android:id="#+id/drawing_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:popupTheme="#style/AppTheme.PopupOverlay"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="#+id/plan_markup_undo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Undo" />
<Button
android:id="#+id/plan_markup_continue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Continue" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ArmgaSys.ConDoc.Droid.Views.DrawingImageView
android:id="#+id/plan_markup_image"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<SkiaSharp.Views.Android.SKCanvasView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/plan_markup_canvas" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="bottom">
<TextView
android:id="#+id/planMarkupMessage"
android:text="Touch and drag to"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:textColor="#000000"
android:textAlignment="center"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#color/primary_light">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is my text" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</LinearLayout>
This is what you want?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
layout="#layout/widget_toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ArmgaSys.ConDoc.Droid.Views.UIColoredSpinner
android:id="#+id/drawing_tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:popupTheme="#style/AppTheme.PopupOverlay"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Button
android:id="#+id/plan_markup_undo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Undo"/>
<Button
android:id="#+id/plan_markup_continue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Continue"/>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="end"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ArmgaSys.ConDoc.Droid.Views.DrawingImageView
android:id="#+id/plan_markup_image"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<SkiaSharp.Views.Android.SKCanvasView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/plan_markup_canvas" />
<TextView
android:id="#+id/planMarkupMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ffffff"
android:gravity="center"
android:text="Touch and drag to"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/primary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is my text"/>
</LinearLayout>
</LinearLayout>
I've only put the father match_parent, and I've adjusted LinearLayout child to his father with match_parent.
[EDIT] I added gravity in LinearLayout parent to end and LinearLayout child has wrap_content width.

Android: ScrollView not working in RelativeLayout properly [duplicate]

This question already has answers here:
How to disable RecyclerView scrolling to make the layout listen its ScrollView parent?
(3 answers)
Closed 5 years ago.
I have problem with ScrollView. I'm trying to get it in Relative Layout. I have tried some solutions,but nothing works.I tried setting my relative layout's height to match_parent but it doesn't work also. I can get it to work with linear layout but I don't want to use it for some reason.
MY Xml code:
`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100">
<LinearLayout
android:id="#+id/actionbarh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/helpdesk_color"
android:orientation="horizontal"
android:weightSum="100">
<ImageView
android:id="#+id/htoolback"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="03dp"
app:srcCompat="#drawable/ic_back"
android:tint="#FFFFFF"
android:layout_gravity="center"
android:gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="83"
android:textColorHint="#FFFFFF"
android:layout_gravity="center"
android:gravity="center"
android:textSize="#dimen/action_size"
android:hint="Help Desk"/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar1"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="15"
android:fitsSystemWindows="true"
android:theme="#style/Theme"
android:listSelector="#android:color/transparent"
app:popupTheme="#style/MyApp.PopupMenu"
android:gravity="center"
app:titleTextColor="#color/white"
xmlns:app="http://schemas.android.com/apk/res-auto"
/>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/sublinerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
app:srcCompat="#drawable/ic_profile"
android:tint="#000000"
android:layout_weight="12"/>
<TextView
android:id="#+id/hstudentname"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="82"
android:textSize="#dimen/large_size"
android:textColorHint="#000000"
android:gravity="left|center"/>
</LinearLayout>
<ScrollView
android:id="#+id/help"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fadeScrollbars="true"
android:scrollbars="vertical"
android:layout_marginBottom="80dp"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fillViewport="true"
android:fadeScrollbars="true"
android:layout_marginBottom="80dp"
android:orientation="vertical">
<LinearLayout
android:id="#+id/idframe"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:padding="2dp"
android:background="#drawable/cardviewhelp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
><ImageView
android:layout_width="wrap_content"
app:srcCompat="#drawable/ic_ticket"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/subject"
android:layout_width="match_parent"
android:paddingLeft="05dp"
android:paddingRight="05dp"
android:gravity="left|center"
android:textColor="#000000"
android:textSize="#dimen/large_size"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="70"
android:textSize="#dimen/medium_m_size"
android:paddingLeft="10dp"
android:editable="false"
android:hint="hint"
android:focusable="false"
android:scrollbars="vertical"
android:gravity="left|center"
android:textColorHint="#000000"
android:background="#00000000"
android:textColor="#000000"/>
<TextView
android:id="#+id/datetime"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="30"
android:textColor="#000000"
android:hint="date"
android:textSize="#dimen/medium_m_size"
android:gravity="right|bottom"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_below="#+id/idframe"
android:id="#+id/toolbarframelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/simpleSwipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="#+id/e_helptoolrecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:stackFromEnd ="true">
</android.support.v7.widget.RecyclerView>
<!--</LinearLayout>-->
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="-80dp"
android:background="#FFFFFF"
android:layout_alignParentBottom="true">
<LinearLayout
android:id="#+id/blow12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100"
android:background="#FFFFFF"
android:gravity="center"
android:layout_gravity="bottom"
android:layout_margin="3dp">
<EditText
android:id="#+id/AddReplay"
android:background="#drawable/cardviewhelp"
android:layout_width="0dp"
android:layout_weight="84"
android:hint="Type a Message"
android:maxLength="200"
android:layout_height="match_parent"
android:layout_marginLeft="12dp"
android:focusable="true"
android:lines="3"
android:scrollbars="vertical"
android:scrollIndicators="start|end"
android:gravity="left|top"
android:inputType="textMultiLine|textFilter"
android:textColor="#000000"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890~`\n !##$%^*()_ -+=|\;;'.,/?"
tools:targetApi="m"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="16"
android:layout_marginLeft="10dp"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/replaybutton"
android:layout_width="wrap_content"
android:src="#mipmap/send"
android:layout_height="wrap_content"
app:civ_border_color="#800080"
app:civ_border_width="2dp"/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_below="#+id/blow12"
android:id="#+id/textcount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginBottom="5dp"
android:textColor="#color/helpdesk_color"
android:text="200 Character Remaining"/>
</RelativeLayout>
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="horizontal"-->
<!--android:weightSum="100"-->
<!--android:layout_alignParentBottom="true"-->
<!--android:background="#FFFFFF"-->
<!--android:layout_gravity="bottom"-->
<!--android:layout_margin="3dp">-->
<!--<com.xw.repo.XEditText-->
<!--android:id="#+id/AddReplay"-->
<!--android:background="#drawable/cardviewhelp"-->
<!--android:layout_width="0dp"-->
<!--android:layout_weight="85"-->
<!--android:hint="Type a Message"-->
<!--android:maxLength="200"-->
<!--android:layout_height="wrap_content"-->
<!--android:padding="2dp"-->
<!--android:layout_alignParentBottom="true"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:focusable="true"-->
<!--android:gravity="left|center"-->
<!--android:inputType="textMultiLine|textFilter"-->
<!--android:textColor="#000000"-->
<!--app:x_disableEmoji="true"/>-->
<!--<de.hdodenhof.circleimageview.CircleImageView-->
<!--android:id="#+id/replaybutton"-->
<!--android:layout_width="0dp"-->
<!--android:src="#mipmap/send"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_weight="16"-->
<!--android:padding="2dp"-->
<!--app:civ_border_color="#800080"-->
<!--app:civ_border_width="2dp"/>-->
<!--</LinearLayout>-->
</RelativeLayout>
</LinearLayout>
<!--</android.support.v4.widget.NestedScrollView>-->
</RelativeLayout>
`
My problem : scrolling only this below layout.but not working whole scrolling in Relative Layout.
`
<LinearLayout
android:id="#+id/idframe"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:padding="2dp"
android:background="#drawable/cardviewhelp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
><ImageView
android:layout_width="wrap_content"
app:srcCompat="#drawable/ic_ticket"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/subject"
android:layout_width="match_parent"
android:paddingLeft="05dp"
android:paddingRight="05dp"
android:gravity="left|center"
android:textColor="#000000"
android:textSize="#dimen/large_size"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="70"
android:textSize="#dimen/medium_m_size"
android:paddingLeft="10dp"
android:editable="false"
android:hint="hint"
android:focusable="false"
android:scrollbars="vertical"
android:gravity="left|center"
android:textColorHint="#000000"
android:background="#00000000"
android:textColor="#000000"/>
<TextView
android:id="#+id/datetime"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="30"
android:textColor="#000000"
android:hint="date"
android:textSize="#dimen/medium_m_size"
android:gravity="right|bottom"/>
</LinearLayout>
</LinearLayout>
`
RecyclerView itself a ScrollView .
Solution
Call NestedScrollView instead of ScrollView .
STRUCTURE
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.RecyclerView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
/>
</android.support.v4.widget.NestedScrollView>
FYI
You should add
recyclerViewOBJ.setNestedScrollingEnabled(false);
If this property is set to true the view will be permitted to initiate
nested scrolling operations with a compatible parent view in the
current hierarchy. If this view does not implement nested scrolling
this will have no effect. Disabling nested scrolling while a nested
scroll is in progress has the effect of stopping the nested scroll.
You should take a scrollview outside of Relative layout
Set your Scrollview to NestedScrollView
<android.support.v4.widget.NestedScrollView>
<android.support.v7.widget.RecyclerView>
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
In your recyclerview
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setHasFixedSize(false);

Android Layout with Scrollview not at bottom - Fragment

What am I doing wrong that I can't get my "toolbar" to show up at the bottom of the screen (the free and post buttons)? I'm having to wrap this all inside a scroll view so that the keyboard will shift the view when displayed.
=======
UPDATE: Sorry I should have stated that the FREE and POST buttons must be at the bottom of the screen and maintain their size.
This is a FRAGMENT and the mainActivity has been set to android:windowSoftInputMode="adjustResize|adjustPan" however keyboard display is not scrolling the either.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CreateFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/red">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/puregreen"
android:id="#+id/createTopView"
android:clickable="false">
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/createRecylerView" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:hint="Title"
android:textSize="24sp"
android:id="#+id/createTitleTextView"
android:layout_below="#+id/createRecylerView"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:hint="Description"
android:textSize="18sp"
android:id="#+id/createDescriptionTextView"
android:layout_below="#+id/createTitleTextView"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="+ Tags"
android:id="#+id/createTagsTextView"
android:textSize="18sp"
android:layout_above="#+id/createBottomToolbar"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:id="#+id/createBottomToolbar"
android:layout_alignParentEnd="true">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FREE"
android:background="#drawable/button_rounded"
android:id="#+id/createCoinButton"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="POST"
android:id="#+id/createPostButton"
android:textColor="#ffffff"
android:layout_alignParentRight="true"
android:background="#color/my_blue" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
I have changed some code please try this code
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/createTopView"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:clickable="false">
<android.support.v7.widget.RecyclerView
android:id="#+id/createRecylerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_height="match_parent"
android:layout_below="#+id/createRecylerView">
<EditText
android:id="#+id/createTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/createRecylerView"
android:hint="Title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="24sp" />
<EditText
android:id="#+id/createDescriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/createTitleTextView"
android:hint="Description"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="18sp" />
<EditText
android:id="#+id/createTagsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/createBottomToolbar"
android:text="+ Tags"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="18sp" />
<LinearLayout
android:orientation="horizontal"
android:id="#+id/createBottomToolbar"
android:layout_width="match_parent"
android:weightSum="1"
android:layout_height="wrap_content"
>
<Button
android:id="#+id/createCoinButton"
android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="match_parent"
android:text="FREE" />
<Button
android:id="#+id/createPostButton"
android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="POST"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
Your toolbar is wrapped in a RelativeLayout which is wrapped in another RelativeLayout of which layout_height is set to wrap_content, here it is:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/red">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" <!-- here -->
android:background="#color/puregreen"
android:id="#+id/createTopView"
android:clickable="false">
Try changing this to match_parent and see if it works.
Why not use linearLayout as the child of scrollView? And set fillViewport property of the scrollView to true to stretch it's contents. Try this code:
<?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"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".CreateFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#color/red">
<LinearLayout
android:id="#+id/createTopView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/puregreen">
<android.support.v7.widget.RecyclerView
android:id="#+id/createRecylerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/createTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="24sp" />
<EditText
android:id="#+id/createDescriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Description"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="18sp" />
<EditText
android:id="#+id/createTagsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="+ Tags"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="18sp" />
<RelativeLayout
android:id="#+id/createBottomToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="#+id/createCoinButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#drawable/button_rounded"
android:text="FREE"
android:textSize="14sp" />
<Button
android:id="#+id/createPostButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="#color/my_blue"
android:text="POST"
android:textColor="#ffffff"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

ScrollView Overlaps Toolbar

I'm trying to use ScrollView and Toolbar as the only childs of LinearLayout but they overlap each other. Searched a bit but didn't find anything useful, any idea how to solve this rather than giving padding/margin to ScrollView?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:float="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="right"
android:background="#color/white_dark_50">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/toolbar"
android:theme="#style/AppTheme"
android:scrollbarStyle="outsideOverlay"
android:gravity="center_vertical|right"
android:layout_alignParentTop="true"
android:background="#color/colorPrimary"
>
<!-- -->
</android.support.v7.widget.Toolbar>
<ScrollView
android:scrollbarStyle="outsideOverlay"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#color/white_dark_50" >
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="right"
android:background="#color/white_dark_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ایجاد جمله جدید"
android:id="#+id/new_sentence_title"
android:textColor="#color/midnight_blue"
android:layout_margin="10dp"
android:textStyle="bold"
android:gravity="center_vertical"
android:drawableRight="#drawable/ic_colored_doll"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_marginLeft="25dp"
android:layerType="software"
android:layout_marginRight="25dp"
android:background="#drawable/dashed_line" />
<com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
float:fletPaddingLeft="10dp"
float:fletPaddingRight="10dp"
android:id="#+id/new_sentence_name"
float:fletPadding="10dp">
<EditText
android:layout_marginLeft="10dp"
android:id="#+id/new_sentence_name_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme"
android:backgroundTint="#color/accentColor"
android:singleLine="true"
android:textColor="#color/midnight_blue"
android:textColorHint="#color/hintColor"
android:maxLength="20"
android:drawableRight="#drawable/ic_name"
android:gravity="center_vertical|right"
android:hint="عنوان"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided>
<com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided
android:layout_width="match_parent"
android:foregroundGravity="center_vertical|right"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
float:fletPaddingLeft="10dp"
float:fletPaddingRight="10dp"
android:id="#+id/new_sentence_period"
float:fletPadding="10dp">
<EditText
android:id="#+id/new_sentence_period_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme"
android:backgroundTint="#color/accentColor"
android:singleLine="true"
android:layout_marginLeft="10dp"
android:inputType="number"
android:textColor="#color/midnight_blue"
android:textColorHint="#color/hintColor"
android:maxLength="20"
android:drawableRight="#drawable/ic_name"
android:gravity="center_vertical|right"
android:hint="دوره تکرار"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<Spinner
android:id="#+id/repeat_kind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/AppTheme"
android:minHeight="25dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="نوع تکرار"
android:id="#+id/doll_type_tv"
android:textColor="#color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:drawableRight="#drawable/ic_doll"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<com.gc.materialdesign.views.ButtonFlat
android:id="#+id/date_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/blue"
android:text="Button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="تاریخ تکرار"
android:textColor="#color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:drawableRight="#drawable/ic_doll"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<com.gc.materialdesign.views.ButtonFlat
android:id="#+id/time_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/blue"
android:text="Button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="زمان تکرار"
android:textColor="#color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:drawableRight="#drawable/ic_doll"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<ImageView
android:id="#+id/doll_pic_IV"
android:layout_width="150dp"
android:layout_height="150dp"
style="#style/AppTheme"
android:minHeight="25dp"
android:scaleType="fitXY"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:src="#drawable/ic_image_add_to_photos"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="انتخاب صدا"
android:textColor="#color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:id="#+id/pic_tv"
android:drawableRight="#drawable/ic_image"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Apparently the problem wasn't overlapping Toolbar with ScrollView, but rather was with ScrollView itself. The problem was arrising from gravity of the only child on ScrollView, so removing gravity from LinearLayout inside ScrollView and the problem was solved. It seems like a bug to me maybe I should contact google and let them know 'bout this.
Try:
<LinearLayout>
<Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
This way the LinearLayout is going to firstly compute the dimension of the toolbar, because it has no layout_weight attributes, and lay it down. Then it assigns all the remaining space to the ScrollView.
i solved this by place toolbar and scroll view in relative layout, then give "android:layout_below="#+id/bar" " in scroll view..
just like this:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="#+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</android.support.design.widget.AppBarLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/bar"
android:paddingTop="20dp"
android:layout_gravity="center">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"/></ScrollView></RelativeLayout>
For my problem: I'm rebuilding an activity into appCompatActivity while using a new standalone toolbar that was being overlapped by a scrollview. My solution was to give the toolbar elevation:
<android.support.v7.widget.Toolbar
...
android:elevation="3dp"
.../>
and increase the margin of the top item in my scrollview.
<EditText
...
android:layout_marginTop="80dp"
.../>
I solved this by adding this with this code, I hope it will help
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false"
android:orientation="vertical"
android:padding="#dimen/activity_vertical_margin"
tools:context="tz.co.ikunda.MemberProfileActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="56dp"
android:orientation="vertical">
<TextView
android:id="#+id/tvMyView"
android:layout_width="match_parent"
android:text="You views goes between this scrollview layout"
android:layout_height="wrap_content" />
</ScrollView>
for me, problem solved simply by put my ScrollView in a Frame layout
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
......
</ScrollView>
</FrameLayout>
For anyone experiencing similar issue with NestedScrollview, set marginTop of root component to that of actionBarSize, i.e.:
android:layout_marginTop="?attr/actionBarSize"

Categories

Resources