The keyboard lifts up the Views in input mode - android

I have Activity with the ScrollView and the Button in the footer. If I click on EditText for input text, the keyboard lifts up the Views. And the Button and the ScrollView shift above of the keyboard. I need to the keyboard not to lift the Views, but should cover on top the Views.
How can I do this?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:id="#+id/primaryLayout"
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:fitsSystemWindows="true"
tools:context="com.test.test.TestActivity">
<LinearLayout
tools:context="com.test.myapplication.MainMenuActivity"
android:background="#color/colorLightGreySubHeaderBg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<include layout="#layout/content_header"/>
<include layout="#layout/content_subheader"/>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorMainWhite"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:background="#color/colorMainWhite"
style="#style/nls_1">
<TextView
android:id="#+id/tvNL1"
tools:text="#string/tools_txt_nl1"
style="#style/tvs_lo_text_32_bold_ellipsized" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/size_20px"
android:paddingBottom="#dimen/size_20px"
android:paddingLeft="#dimen/paddingLayoutDefaultNormal"
android:paddingRight="#dimen/paddingLayoutDefaultNormal"
android:background="#color/colorLightGreySubHeaderBg"
android:orientation="vertical">
<TextView
android:id="#+id/testName"
android:text=""
tools:text="#string/tools_txt_test"
style="#style/tvs_lo_text_26_bold" />
<TextView
android:id="#+id/testType"
style="#style/tvs_lo_text_26"
tools:text="#string/tools_txt_test2"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#color/colorMainWhite">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="#dimen/size_35px"
android:paddingLeft="#dimen/paddingLayoutDefaultNormal"
android:paddingRight="#dimen/paddingLayoutDefaultNormal">
<TextView
style="#style/tvs_lo_text_26"
android:paddingBottom="#dimen/size_35px"
android:text="#string/txt_enter"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/size_30px"
android:orientation="horizontal">
<ImageView
android:id="#+id/icontest"
android:layout_alignParentLeft="true"
android:layout_width="#dimen/size_45px"
android:layout_height="#dimen/size_45px"
android:src="#drawable/icon_test"/>
<EditText
android:id="#+id/editTextTest"
android:layout_toRightOf="#+id/iconTestId"
android:layout_toLeftOf="#+id/testAbbreviation"
android:paddingLeft="#dimen/size_20px"
android:inputType="numberDecimal"
android:hint="#string/txt_test"
android:textColorHint="#color/colorTxtMainBlue"
android:background="#color/colorMainWhite"
style="#style/ets_lo_text_32_blue"/>
<TextView
android:id="#+id/testAbbreviation"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/tvs_lo_text_32_blue"
tools:text="test"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorMainBlue"/>
<TextView
style="#style/tvs_lo_text_26"
android:paddingTop="#dimen/size_35px"
android:paddingBottom="#dimen/size_35px"
android:text="#string/txt_test"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/size_30px">
<ImageView
android:id="#+id/iconDescriptionId"
android:layout_alignParentLeft="true"
android:layout_width="#dimen/size_45px"
android:layout_height="#dimen/size_45px"
android:src="#drawable/icon_test"/>
<EditText
android:layout_toRightOf="#+id/iconDescriptionId"
android:paddingLeft="#dimen/size_20px"
android:inputType="textMultiLine"
android:minLines="1"
android:id="#+id/editTextTest"
android:hint="#string/txt_test"
style="#style/ets_lo_text_32_blue"
android:textColorHint="#color/colorTxtMainBlue"
android:background="#color/colorMainWhite"
android:singleLine="true"
android:maxLines="1" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorMainBlue"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorMainWhite"
android:orientation="horizontal">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/paddingLayoutDefaultNormal"
android:paddingLeft="#dimen/paddingLayoutDefaultNormal"
android:paddingRight="#dimen/paddingLayoutDefaultNormal"
android:paddingTop="#dimen/paddingLayoutDefaultNormal"
android:gravity="bottom">
<include layout="#layout/layout_blue_button" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Try using this in your activity:
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
or in your Manifest:
<activity
...
android:windowSoftInputMode="adjustPan">
</activity>

Related

Why my edittext layout and keyboard overlaps?

When I click edittext my layout stays under keyboard. It overlaps. I would like to move keyboard up when I click the edittext. Could you please help me with this problem ?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="#+id/rootLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/footer_height"
android:layout_alignParentTop="true"
android:background="#color/colorPrimary"
android:elevation="1dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="#+id/chat_back_button"
style="#style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:background="#drawable/image_back"/>
<TextView
android:id="#+id/chat_Header_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/str_chat"
android:textColor="#android:color/white"
android:textSize="#dimen/activity_list_header_size"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dp"
android:layout_marginTop="54dp">
<ListView
android:id="#+id/chat_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:divider="#null"
android:dividerHeight="0dp"
android:transcriptMode="alwaysScroll"></ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/chat_edit_layout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/colorPrimaryDark"
android:orientation="vertical"
android:padding="0.5dp"
android:layout_above="#+id/chat_footer_layout"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="horizontal">
<EditText
android:id="#+id/chat_edit"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:background="#android:color/white"
android:gravity="start|center_vertical"
android:hint="#string/mesaj_yaz"
android:padding="2dp"/>
<ImageView
android:id="#+id/chat_send"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:onClick="sendMessage"
android:src="#drawable/chat_icon"
android:visibility="gone"/>
<TextView
android:id="#+id/chat_text"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:background="#color/colorPrimaryDark"
android:gravity="center"
android:onClick="sendMessage"
android:text="#string/gonder"
android:textColor="#android:color/white"
android:textSize="#dimen/activity_list_header_size"/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/chat_footer_layout"
android:layout_width="match_parent"
android:layout_height="#dimen/footer_height"
android:layout_alignParentBottom="true"
>
<!--android:elevation="1dp"-->
<ImageView
android:id="#+id/chat_footer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"/>
</RelativeLayout>
I added
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); in onCreate() method. Also I added android:windowSoftInputMode="adjustResize" to activity in Manifest.xml. But still doesn't work.
try scrollView as parent layout and use "adjustPan" in your manifest
android:id="#+id/main_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"

ScrollView is not working inside the FrameLayout

The Below is my code i am not able to scroll the layout looking weird when i put scrollview
<FrameLayout 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="#0099cc"
tools:context="willapp.stpl.com.willapp.util.ActivityPrintView">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="horizontal">
<!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc. -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/rootLayout">
<LinearLayout
android:id="#+id/table1heading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select executer's relationship"
android:id="#+id/txtHeading"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:id="#+id/mainactivity_layoutName"
android:layout_below="#+id/table1heading"
android:layout_centerVertical="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/mainactivity_txtLabelName"
android:text="Full Name:"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1">
</View>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/mainactivity_txtValueName"
android:text="Sssdadaad"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/mainactivity_layoutLine1"
android:padding="5dp"
android:layout_below="#+id/mainactivity_layoutName"
android:layout_centerVertical="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/mainactivity_txtLabelLine1"
android:text="Address Line1:"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1">
</View>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/mainactivity_txtValueLine1"
android:text="Sssdadaad"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</FrameLayout>
Inside ScrollView try to use LinearLayout instead of RelativeLayout.
Something like this:
<FrameLayout 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="#0099cc"
tools:context="willapp.stpl.com.willapp.util.ActivityPrintView">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
// and here your main Relative layout
</LinearLayout>
</ScrollView>
</FrameLayout>

change alignment and position of android layout

I have main layout activity_user_profile which include these three layout: First_layout,
Second_layout,
list_item.
activity_user_profile.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<include layout="#layout/first_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<include layout="#layout/second_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<include layout="#layout/list_item"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</ScrollView>
list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/listView" />
<TextView
android:id="#+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="2dip"
android:textStyle="bold"/>
<TextView
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
As seen in the image, there is a white gap between bottom and list_item.xml.
How can shift this layout to right and extend it to bottom of the page?
Update
first_layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content"
android:layout_height="match_parent" android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="UserProfile"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView3"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_weight="7.03"
android:textSize="15sp"/>
</LinearLayout>
second_layout.xml
<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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:orientation="vertical"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin" tools:context=".Main3Activity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:id="#+id/textView"
android:visibility="gone" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextName"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:id="#+id/textView2"
android:visibility="gone" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextAddress"
android:visibility="gone" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Post"
android:onClick="insert"
android:id="#+id/button"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textViewResult" />
</LinearLayout>
Have searched this for a long time and concluded this :
Remove,
android:orientation="vertical"
android:layout_weight="1"
Check that :
Scroll view must have a single child (i.e all views must be included
within a single root layout inside scroll view)
ScrollView works when your page size is greater the default height
of the screen.
try this
Replace your activity_user_profile.xml by this
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<include layout="#layout/first_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_weight="1"/>
<include layout="#layout/second_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_weight="1"
/>
<include layout="#layout/list_item"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_weight="1"/>
</LinearLayout>
</ScrollView>
I have made following changes in your layout.....
See code below
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="3"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<include layout="#layout/first_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<include layout="#layout/second_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<include layout="#layout/list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
The child of the scroll view should have it's height set to "wrap_content" to allow scrolling.
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
Change this to:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

How to apply background Image on ScrollView android

I want to apply background image on Relativelayout Under ScrollView.
The Image Appear on XML View but Not Appear on Actual device.
I have added ImageView on Ralativelayout
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:id="#+id/parentView"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/cloudbg"
/>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:id="#+id/vo"
android:layout_below="#id/relativeLayout"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="XYZ"
/>
<TextView
android:layout_width="wrap_content"
android:layout_marginLeft="25dp"
android:layout_height="wrap_content"
android:id="#+id/textvo"
android:text="Voter Number"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
Thanks
can try this way:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/cloudbg">
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:id="#+id/vo"
android:layout_below="#id/relativeLayout"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="XYZ"
/>
<TextView
android:layout_width="wrap_content"
android:layout_marginLeft="25dp"
android:layout_height="wrap_content"
android:id="#+id/textvo"
android:text="Voter Number"
/>
</LinearLayout>
</ScrollView>
Use android:background="#drawable/background_image" attribute in Relative or Linear Layout tag.
Set background for scrollview
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/ic_launcher" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>

positioning layout in android

I have something like to this:
I want that when the relative_layout stretch to fill the screen, stretch layout_content (layout_header and layout_footer not resize).
And when the screen size is smaller than layouts then scrool
My code currently looks like this:
<ScrollView android:layout_width="fill_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/layout_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
...
</LinearLayout>
<LinearLayout
android:id="#+id/layout_center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="#+id/layout_header">
...
</LinearLayout>
<LinearLayout
android:id="#+id/layout_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="#+id/layout_center">
...
</LinearLayout>
</RelativeLayout >
</ScrollView>
Excuse my english, thank you very much. I Wear long time without this fix and have tried with different layout.
Try this..
<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" >
<LinearLayout
android:id="#+id/layout_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="top"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_center"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="center"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="bottom"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Place the ScrollView only for LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/layout_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
...
</LinearLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="#+id/layout_center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="#+id/layout_header">
...
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/layout_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="#+id/layout_center">
...
</LinearLayout>
</RelativeLayout >

Categories

Resources