Coordinator Layout View prevents other layouts from being displayed? - android

I have a CoordinatorLayout used for displaying an AppBarLayout. However, the issue is that my RelativeLayout and LinearLayout are hidden by my ListView. Moreover, my ListView does not show fully: rather, part of the first ListView element is cut off but I can scroll through and see the rest. Below was my attempt:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
xmlns:fresco="http://schemas.android.com/tools"
android:id="#+id/comments_coordinator_layout">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/comments_appbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_below="#id/comments_coordinator_layout"
android:id="#+id/view_post"
android:layout_width="match_parent"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:orientation="horizontal"
android:layout_height="175dp"
android:background="#e6e6e6">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginTop="15dp"
android:id="#+id/poster_picture"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_marginLeft="10dp"
fresco:placeholderImage="#mipmap/blank_prof_pic"
fresco:roundedCornerRadius="5dp"
/>
<TextView
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold"
android:id="#+id/poster_name"/>
<TextView
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_name"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="#+id/post_date"/>
<TextView
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_below="#id/poster_name"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/view_status" />
</RelativeLayout>
<ListView
android:id="#+id/lv_comments_feed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/send_message"
android:layout_below="#id/view_post">
</ListView>
<LinearLayout
android:id="#+id/send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:id="#+id/write_comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:gravity="top|left"
android:hint="Comment back!"
android:inputType="textMultiLine"
android:background="#color/white"
android:scrollHorizontally="false" />
<Button
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
One thing I don't understand is why when I click on the design tab of my layout, it just seems like all my layouts overlap each other as opposed to displaying below each other. Furthermore, I don't see why the ListView is prioritized being shown over my LinearLayout and RelativeLayout. Is there any way I can get it so that I have the following structure from top to bottom: AppBarLayout -> RelativeLayout -> ListView -> LinearLayout. Any help would be appreciated. Thanks!
If it means anything, in my AndroidManifest, I have android:windowSoftInputMode="stateVisible"
Block quote
EDIT: this is an example of what I want to achieve
Edit: After taking some advice from tiny sunshine, here is what I have so far:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
xmlns:fresco="http://schemas.android.com/tools"
android:id="#+id/comments_coordinator_layout">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/comments_appbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_marginTop="?attr/actionBarSize"
android:layout_below="#id/comments_coordinator_layout"
android:id="#+id/view_post"
android:layout_width="match_parent"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:orientation="horizontal"
android:layout_height="175dp"
android:background="#e6e6e6">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginTop="15dp"
android:id="#+id/poster_picture"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_marginLeft="10dp"
fresco:placeholderImage="#mipmap/blank_prof_pic"
fresco:roundedCornerRadius="5dp"
/>
<TextView
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold"
android:id="#+id/poster_name"/>
<TextView
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_name"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="#+id/post_date"/>
<TextView
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_below="#id/poster_name"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/view_status" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_marginTop="225dp"
android:id="#+id/lv_comments_feed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/send_message">
</ListView>
<LinearLayout
android:id="#+id/send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:id="#+id/write_comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:gravity="top|left"
android:hint="Comment back!"
android:inputType="textMultiLine"
android:scrollHorizontally="false" />
<Button
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
EDIT: Issue with EditText. As you can see, the layout only shows the ListView when I click the EditText and hides everything including the ActionToolBar and Status Bar.
Edit: Showing Android Manifest
<activity android:name=".com.tabs.activity.Comments"
android:label="View Post"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".com.tabs.activity.news_feed"/>
</activity>
Edit: Suggestion by Tiny Sunlight:
<FrameLayout>
<ToolBar></ToolBar>
<Relative Layout as List header></RelativeLayout as ListHeader>
<ListView></ListView>
<LinearLayout for Edit Text></LinearLayout for EditText>
</FrameLayout>

Just add a ScrollView and set softInputMode to adjustResize.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:fitsSystemWindows="true"
android:layout_width="match_parent" android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<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:fitsSystemWindows="true"
xmlns:fresco="http://schemas.android.com/tools"
android:id="#+id/comments_coordinator_layout">
<android.support.v7.widget.Toolbar
android:layout_alignParentTop="true"
android:id="#+id/comments_appbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<RelativeLayout
android:layout_below="#id/comments_appbar"
android:id="#+id/view_post"
android:layout_width="match_parent"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:orientation="horizontal"
android:layout_height="175dp"
android:background="#e6e6e6">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginTop="15dp"
android:id="#+id/poster_picture"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_marginLeft="10dp"
fresco:placeholderImage="#mipmap/blank_prof_pic"
fresco:roundedCornerRadius="5dp"
/>
<TextView
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold"
android:id="#+id/poster_name"/>
<TextView
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_name"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="#+id/post_date"/>
<TextView
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_below="#id/poster_name"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/view_status" />
</RelativeLayout>
<ListView
android:id="#+id/lv_comments_feed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/send_message"
android:layout_below="#id/view_post">
</ListView>
<LinearLayout
android:id="#+id/send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:id="#+id/write_comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:gravity="top|left"
android:hint="Comment back!"
android:inputType="textMultiLine"
android:background="#color/white"
android:scrollHorizontally="false" />
<Button
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</RelativeLayout>
</ScrollView>

Related

Xamarin Android CoordinatorLayout hide/show another layout than toolbar

I need a help with CoordinatorLayout... I need hide/show toolbar when scrolling and together with this hiding behavior I need make smaller text and hide another layout in my AppBarLayout...
My layout looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/main_light_gray">
<include
layout="#layout/toolbar_layout_filter_sales" />
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
local:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/main_light_gray">
<android.support.design.widget.TabLayout
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:id="#+id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/tablayout_background"
local:tabIndicatorColor="#color/main_red"
local:tabIndicatorHeight="0dp"
local:tabGravity="center"
local:tabBackground="#drawable/tab_background_selector"
local:tabMode="fixed"
local:tabPaddingStart="20dp"
local:tabPaddingEnd="20dp"
local:tabTextColor="#color/main_dark_text"
local:tabSelectedTextColor="#color/white" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
local:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</RelativeLayout>
<!--</LinearLayout>-->
</android.support.design.widget.CoordinatorLayout>
Layout toolbar_layout_filter_sales looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/layout_rounded_corners"
android:stateListAnimator="#null"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
local:layout_scrollFlags="scroll|enterAlways"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_marginTop="25dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:textStyle="bold"
android:textColor="#color/white"
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
style="#style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_gravity="center" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:id="#+id/toolbar_refresh_layout"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/toolbar_refresh"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerInside"
android:src="#drawable/ic_refresh" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="#+id/filterLayout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp">
<TextView
android:textSize="18dp"
android:textStyle="bold"
android:ellipsize="marquee"
android:maxLines="1"
android:text="Today"
local:MvxBind="Text SelectedFilterText"
android:textColor="#color/white"
android:id="#+id/filterTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="1dp" />
<Button
android:textAllCaps="false"
android:id="#+id/filterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="15.5.2018"
local:MvxBind="Text CurrentPeriod"
android:ellipsize="marquee"
android:maxLines="1"
android:textColor="#color/white"
android:gravity="center_vertical"
android:textStyle="normal"
android:background="#android:color/transparent"
android:drawableEnd="#drawable/arrow_down_white"
android:drawablePadding="10dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="0dp" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/main_dark_line"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="0dp" />
<LinearLayout
android:id="#+id/filterLayout"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp">
<TextView
android:text="58 395,00"
local:MvxBind="TextFormatted TotalSales, Converter=SpannableStringPriceConverter"
android:textSize="26dp"
android:textStyle="bold"
android:ellipsize="marquee"
android:maxLines="1"
android:textColor="#color/white"
android:id="#+id/salesTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp" />
<TextView
local:MvxBind="Text LastUpdate, Converter=LastUpdateConverter"
android:textSize="12dp"
android:textStyle="italic"
android:ellipsize="marquee"
android:maxLines="1"
android:text="XX"
android:textColor="#color/white"
android:id="#+id/lastUpdateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
In default it looks like this:
After scrolling I have this:
But I need something like this:
I need text with value make smaller and text under value hide.

android - Adjust resize and scrollview not working with edittext

I have this form and when the soft keyboard is open, the screen does not resize and dont make scroll on it.
I really want to know why. Why my view does not scroll? Why does not resize?
This is my xml:
<?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:fitsSystemWindows="true"
>
<ScrollView
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#android:color/transparent"
android:visibility="invisible"
app:navigationIcon="#drawable/ic_left_arrow"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="#+id/imageView9"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:src="#drawable/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView9"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/imageView9"
android:layout_below="#+id/imageView9"
android:layout_marginLeft="15dp"
android:paddingBottom="6dp"
android:text="OFERTAR OU \nSIMULAR LANCE"
android:textColor="#eb262a"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/livre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Livre" />
<RadioButton
android:id="#+id/fixo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Fixo" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Percentual do lance">
<EditText
android:id="#+id/percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView12"
android:layout_toStartOf="#+id/textView12"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusDown="#+id/value"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textView12"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="%"
android:textColor="#000"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Valor do lance">
<EditText
android:id="#+id/value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Número do Protocolo">
<EditText
android:id="#+id/protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="10">
<Button
android:id="#+id/limpar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Limpar"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="#+id/simular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Simular"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="#+id/registrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Registrar"
android:textColor="#ffffff"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="Lance Fixo é definido em 30%"
android:textAlignment="center"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
</LinearLayout>
I already tried set match_parent to scrollview.
And I have this in my manifest android:windowSoftInputMode="stateAlwaysHidden|adjustResize".
If you are using "FULLSCREEN" theme for your application or activity then the "RESIZE" functionality will not work, you should use "NoTitleBar" theme without "FULLSCREEN".
It will work 100%.
And you should use "RelativeLayout" in place of parent layout(main linearlayout).
I found the problem. I'm using <item name="android:windowFullscreen">true</item>
and when the fullscreen flags are actived, the resize dont work.
If you want to resize the activity when the keyboard pops up you need to specify a line of code in manifest file inside activity tag :
android:windowSoftInputMode="adjustResize"
Refer this link for more details : https://developer.android.com/training/keyboard-input/visibility.html
You can even try to adjust screen in activity put the below code in you activity onCreate method:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Hope this should help!!
add this line to activity which you want to resize on opening soft keyboard:
android:windowSoftInputMode="adjustResize"
UPDATE POST:
<?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:fitsSystemWindows="true"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#android:color/transparent"
android:visibility="invisible"
app:navigationIcon="#drawable/ic_left_arrow"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="#+id/imageView9"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:src="#drawable/logo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView9"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/imageView9"
android:layout_below="#+id/imageView9"
android:layout_marginLeft="15dp"
android:paddingBottom="6dp"
android:text="OFERTAR OU \nSIMULAR LANCE"
android:textColor="#eb262a"
android:textSize="20sp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/livre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Livre"/>
<RadioButton
android:id="#+id/fixo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Fixo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Percentual do lance">
<EditText
android:id="#+id/percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView12"
android:layout_toStartOf="#+id/textView12"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusDown="#+id/value"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textView12"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="%"
android:textColor="#000"
android:textSize="16dp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Valor do lance">
<EditText
android:id="#+id/value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Número do Protocolo">
<EditText
android:id="#+id/protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="10">
<Button
android:id="#+id/limpar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Limpar"
android:textColor="#ffffff"
android:visibility="visible"/>
<Button
android:id="#+id/simular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Simular"
android:textColor="#ffffff"
android:visibility="visible"/>
<Button
android:id="#+id/registrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Registrar"
android:textColor="#ffffff"
android:visibility="gone"/>
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="Lance Fixo é definido em 30%"
android:textAlignment="center"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

Edit Text does not stretch automatically when Landscape Android

I am really new in Android programming. I try to design chat layout but i found some problem of layout design. Why the Edit Text layout doesn't stretch automatically in landscape mode?
Here is the preview
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="#+id/myappbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom">
<include
layout="#layout/input_message_area"
android:layout_width="fill_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:gravity="bottom" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/myappbar"
android:layout_marginTop="?attr/actionBarSize"
android:layout_marginBottom="75dp"
android:background="#63DDEC"
android:paddingLeft="5dip"
android:paddingTop="0dip"
android:paddingRight="5dip"
android:paddingBottom="1dip">
<ListView
android:id="#+id/lv_chat_story"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="#color/colorTransparent"
android:dividerHeight="0dp" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
and this is for input_message_area.xml
<?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:background="#63DDEC"
android:gravity="bottom"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/inputLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/rounded_corner_a"
android:layout_marginLeft="10dp"
android:layout_marginTop="1dp"
android:layout_marginRight="7dp"
android:layout_marginBottom="5dp"
android:padding="3dp">
<Button
android:id="#+id/buttonEmoji"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:background="#drawable/smile_center" />
<EditText
android:id="#+id/chat_edit_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="0dp"
android:scrollHorizontally="false"
android:layout_toRightOf="#id/buttonEmoji"
android:hint="Type a message"
android:maxLines="4"
android:singleLine="false"
android:inputType="textCapSentences"
android:textSize="18sp"
android:paddingLeft="4dp"/>
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/chat_edit_text1"
android:background="#drawable/camera_center"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_main"
android:layout_toRightOf="#id/inputLayout"
android:layout_alignBaseline="#+id/inputLayout"
android:layout_alignBottom="#+id/inputLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-10dp"
android:layout_marginLeft="-10dp"
android:layout_marginRight="16dp"
android:clickable="true"
android:src="#drawable/send_center"
app:backgroundTint="#color/colorPrimary"
app:layout_anchor="#id/inputLayout"
app:layout_anchorGravity="bottom|right" />
</LinearLayout>
Thank you.
Add weight to RelativeLayout.
please find my code. This will help you.
input_message_area.xml
<?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:background="#63DDEC"
android:gravity="bottom"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/inputLayout"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/rounded_corner_a"
android:layout_marginLeft="10dp"
android:layout_marginTop="1dp"
android:layout_marginRight="7dp"
android:layout_marginBottom="5dp"
android:padding="3dp">
<Button
android:id="#+id/buttonEmoji"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:background="#drawable/smile_center" />
<EditText
android:id="#+id/chat_edit_text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="0dp"
android:scrollHorizontally="false"
android:layout_toRightOf="#id/buttonEmoji"
android:hint="Type a message"
android:layout_marginRight="50dp"
android:maxLines="4"
android:singleLine="false"
android:inputType="textCapSentences"
android:textSize="18sp"
android:paddingLeft="4dp"/>
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/camera_center"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_main"
android:layout_toRightOf="#id/inputLayout"
android:layout_alignBaseline="#+id/inputLayout"
android:layout_alignBottom="#+id/inputLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-10dp"
android:layout_marginLeft="-10dp"
android:layout_marginRight="16dp"
android:clickable="true"
android:src="#drawable/send_center"
app:backgroundTint="#color/colorPrimary"
app:layout_anchor="#id/inputLayout"
app:layout_anchorGravity="bottom|right" />
Give android:layout_width="match_parent" to your Edit Text.
<EditText
android:id="#+id/chat_edit_text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="0dp"
android:scrollHorizontally="false"
android:layout_toRightOf="#id/buttonEmoji"
android:hint="Type a message"
android:maxLines="4"
android:singleLine="false"
android:inputType="textCapSentences"
android:textSize="18sp"
android:paddingLeft="4dp"/>
Change EditText width from wrap_content to match_parent.
input_message_area.xml
<?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:background="#63DDEC"
android:gravity="bottom"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/inputLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/rounded_corner_a"
android:layout_marginLeft="10dp"
android:layout_marginTop="1dp"
android:layout_marginRight="7dp"
android:layout_marginBottom="5dp"
android:padding="3dp">
<Button
android:id="#+id/buttonEmoji"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:background="#drawable/smile_center" />
<EditText
android:id="#+id/chat_edit_text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="0dp"
android:scrollHorizontally="false"
android:layout_toRightOf="#id/buttonEmoji"
android:hint="Type a message"
android:maxLines="4"
android:singleLine="false"
android:inputType="textCapSentences"
android:textSize="18sp"
android:paddingLeft="4dp"/>
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/chat_edit_text1"
android:background="#drawable/camera_center"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_main"
android:layout_toRightOf="#id/inputLayout"
android:layout_alignBaseline="#+id/inputLayout"
android:layout_alignBottom="#+id/inputLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-10dp"
android:layout_marginLeft="-10dp"
android:layout_marginRight="16dp"
android:clickable="true"
android:src="#drawable/send_center"
app:backgroundTint="#color/colorPrimary"
app:layout_anchor="#id/inputLayout"
app:layout_anchorGravity="bottom|right" />
</LinearLayout>

My include layout in coordinate layout overlapping with another layout

I am working on a coordinator layout with a nested scroll view. I also have 3 buttons at the bottom of my screen in my layout. Now when I scroll the layout the last elements of my scroll view being overlapped with the buttons I put at the bottom. I tried using a relative layout as parent to get rid of this problem but it is still persisting. So how can I get rid of this problem?The layouts are given below:
activity_agent_profile_2:
<?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"
android:background="#fff"
tools:context=".AgentProfileActivity2">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:fitsSystemWindows="true"
android:layout_above="#+id/laytbtns">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="270dp"
android:fitsSystemWindows="true"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/agent_profile_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="125dp"
app:expandedTitleMarginStart="118dp"
app:expandedTitleTextAppearance="#style/expandedappbar"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
<ImageView
android:id="#+id/backdrop"
android:layout_width="match_parent"
android:layout_height="180dp"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/back" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="#66000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="120dp"
android:orientation="vertical">
<TextView
android:id="#+id/lbl_agent_profile_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lbl_agent_profile_Name"
android:ellipsize="end"
android:maxLines="1"
android:text="Real Estate Professional at Exit Alliance Realty"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textSize="12sp"
android:typeface="sans" />
<TextView
android:id="#+id/lbl_agent_profile_membersince"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Member Since: 2015"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#fff"
android:textSize="13sp"
android:typeface="sans" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="#+id/img_agent_profile_image"
android:layout_width="100dp"
android:layout_height="140dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:scaleType="fitStart"
android:src="#drawable/no_profile" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/backdrop"
android:layout_marginLeft="5dp"
android:layout_toEndOf="#+id/img_agent_profile_image"
android:layout_toRightOf="#+id/img_agent_profile_image"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<ImageView
android:id="#+id/imageView13"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_phone_img" />
<TextView
android:id="#+id/lbl_agent_profile_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toEndOf="#+id/imageView13"
android:layout_toRightOf="#+id/imageView13"
android:text="01723735134"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#56698F"
android:textSize="13sp"
android:typeface="sans" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<ImageView
android:id="#+id/imageView14"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_location_nopadding" />
<TextView
android:id="#+id/lbl_agent_profile_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toEndOf="#+id/imageView14"
android:layout_toRightOf="#+id/imageView14"
android:ellipsize="end"
android:maxLines="1"
android:text="2868 Al Urabuh Road, Al Urudh, Ryadh"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#56698F"
android:textSize="12sp"
android:typeface="sans" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<ImageView
android:id="#+id/imageView15"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_website" />
<TextView
android:id="#+id/lbl_agent_profile_website"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toEndOf="#+id/imageView15"
android:layout_toRightOf="#+id/imageView15"
android:ellipsize="end"
android:maxLines="1"
android:text="www.ibaax.com"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#56698F"
android:textSize="12sp"
android:typeface="sans" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginTop="-50dp"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_agent_profile" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="#+id/laytbtns"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#495B81">
<Button
android:id="#+id/testbutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#56688f"
android:onClick="btnEmail_click"
android:text="Message"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="sans" />
<Button
android:id="#+id/SMSButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#56688f"
android:onClick="btnSMS_click"
android:text="SMS"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="sans" />
<Button
android:id="#+id/cancelButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#56688f"
android:onClick="btnPhone_click"
android:text="Call"
android:textColor="#fff"
android:textStyle="bold"
android:typeface="sans" />
</LinearLayout></RelativeLayout>
content_agent_profile.xml:
<android.support.v4.widget.NestedScrollView 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="#fff"
android:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".AgentProfileActivity2"
tools:showIn="#layout/activity_agent_profile2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Specialities"
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/lbl_agent_profile_specialites"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Service Area"
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/lbl_agent_profile_service"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Profile Summery "
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<WebView
android:id="#+id/web_agentprofile_description"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="5dp"
android:background="#d3d3d3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Active Listing"
android:textColor="#60aaff"
android:textSize="18sp"
android:textStyle="bold" />
<UI.ExpandableHeightGridView
android:id="#+id/gridview_agent_property"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:horizontalSpacing="2dp"
android:isScrollContainer="false"
android:numColumns="1"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" />
</LinearLayout>
</LinearLayout></android.support.v4.widget.NestedScrollView>
Here is an image of the issue:
Contents in scroll view is being overlapped
Edit:
So I fixed the issue by setting a margin-bottom to 80dp in my nested scroll view. It seems to work for now but it is not a permanent solution. If anyone can come up with a better solution, I will be really grateful.
<include layout="#layout/content_agent_profile"
android:layout_above="#+id/your above layout id"
android:layout_below="#+id/below layout id"/>
So I fixed the issue by setting a margin-bottom to 80dp in my nested scroll view. It seems to work for now but it is not a permanent solution. If anyone can come up with a better solution, I will be really grateful.
If you're using ConstraintLayout and your included layout overlapping other views, then give your include layout height and width.
<include
android:id="#+id/errorScreen"
layout="#layout/error_screen_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/topView"/>

Android ScrollView not working properly when use toolbar

I developed an android application in which the scroll-view is not scrolling.. I am posting the code here pls check and if found any error pls help.. Here I used RelativeLayout as root and then Scroll-view and Relative Layout inside the scroll-view and ... Edit text ans Spinner inside relative layout... but this is not scrolling up..
This is my XML :-
<?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:background="#android:color/white">
<LinearLayout
android:id="#+id/ll1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/tool_bar"
layout="#layout/app_bar" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
android:layout_above="#+id/btnAccept"
android:layout_below="#+id/ll1"
>
<RelativeLayout
android:id="#+id/rel_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TextView
android:id="#+id/txvPanmain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="WANT TO GET IN TOUCH WITH US?"
android:textColor="#131517"
android:textSize="18sp"
android:textStyle="bold" />
<android.support.design.widget.TextInputLayout
android:id="#+id/floatedtFullName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txvPanmain"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtFullName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:hint="Full Name"
android:inputType="textCapSentences"
android:textColor="#android:color/black"
android:textColorHint="#ff0000"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="#+id/spinCountry"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/floatedtFullName"
android:layout_marginTop="15dp"
android:entries="#array/country"
android:prompt="#string/addressProof" />
<View
android:id="#+id/vspincountry"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/spinCountry"
android:layout_marginTop="2dp"
android:background="#000000" />
<Spinner
android:id="#+id/spinCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/vspincountry"
android:layout_marginTop="15dp"
android:entries="#array/country"
android:prompt="#string/addressProof" />
<View
android:id="#+id/vspincity"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/spinCity"
android:layout_marginTop="2dp"
android:background="#000000" />
<android.support.design.widget.TextInputLayout
android:id="#+id/float_edit_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/vspincity"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:hint="Email id"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textColorHint="#A4A4A4"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/float_edit_mobileno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/float_edit_email"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:hint="Mobile no."
android:inputType="phone"
android:maxLength="10"
android:textColor="#android:color/black"
android:textColorHint="#A4A4A4"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="#+id/spinFeedback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/float_edit_mobileno"
android:layout_marginTop="10dp"
android:entries="#array/country"
android:prompt="#string/addressProof" />
<View
android:id="#+id/vspinFeedback"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/spinFeedback"
android:layout_marginTop="2dp"
android:background="#000000" />
<android.support.design.widget.TextInputLayout
android:id="#+id/float_edit_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/vspinFeedback"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:inputType="text"
android:hint="Comments"
android:lines="3"
android:maxLines="3"
android:textColor="#android:color/black"
android:textColorHint="#A4A4A4"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/btnAccept"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/red"
android:layout_alignParentBottom="true"
android:padding="5dp"
android:text="SUBMIT"
android:textColor="#color/white_color"
android:textSize="20sp"
android:textStyle="normal" />
<ProgressBar
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
This is my app_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 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="wrap_content"
android:background="#color/colorPrimary"
android:paddingTop="#dimen/app_bar_top_padding"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/Base.ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="22sp"
android:textColor="#android:color/white"
android:textStyle="bold"
android:text="Toolbar Title" />
</android.support.v7.widget.Toolbar>
Your ScrollView has to be a defined height. Try match_parent instead of wrap_content. When a ScrollView wraps its contents there is nothing beeing clipped of you might be able to scroll to.

Categories

Resources