Again I spent hours to resolve this (easy) but for me hard problem. I can't put button at botton of view.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<WebView
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</LinearLayout>
You can't do that in a LinearLayout. Instead try a RelativeLayout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<WebView
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
</LinearLayout>
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Button" />
</LinearLayout>
Related
I use Linear Layout in my code and I want to add buttons in my activity using vertical scrollbar. But I'm not able to add more than one button in android. Drag and drop is not working and also manual xml coding doesn't work either. Please help
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:id="#+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/chco"
tools:context="com.example.tset.test.Prerequisites">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</LinearLayout>
</ScrollView>
Try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/chco"
tools:context="com.example.tset.test.Prerequisites"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="#+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
Try this
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:id="#+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/chco"
tools:context="com.example.tset.test.Prerequisites">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<Button
android:id="#+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Traveler Login" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Login" />
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:id="#+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/chco"
tools:context="com.example.tset.test.Prerequisites">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
Try this
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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:gravity="center_vertical"
android:background="#drawable/login_bg"
tools:context=".activities.LoginActivity">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/submit"
android:textSize="18sp"
android:text="Login"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/submit1"
android:textSize="18sp"
android:text="Login1"/>
</LinearLayout>
</ScrollView>
I have a LinearLayout and dynamically created elements in it. I need to make it scrollable if its height will be larger than 0.8 of screen's height. I'm trying to do it like that. Where is my mistake?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:id="#+id/layoutContainer" android:orientation="vertical"
android:baselineAligned="false" android:weightSum="1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="vertical"
android:layout_weight="0.85" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:id="#+id/alarmsLayout" android:orientation="vertical"
android:layout_marginTop="70dp" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.15">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/addAlarmBtn"
android:src="#drawable/time"
android:layout_marginBottom="15dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layoutContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:baselineAligned="false"
android:orientation="vertical" >
<ScrollView
android:layout_weight="0.8"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbars="vertical" >
<LinearLayout
android:id="#+id/alarmsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.15" >
<ImageView
android:id="#+id/addAlarmBtn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginBottom="15dp"
android:src="#drawable/background_button" />
</RelativeLayout>
</LinearLayout>
Try using this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width ="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width ="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/alarmsLayout" android:orientation="vertical"
android:layout_marginTop="70dp" >
</LinearLayout>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginBottom="15dp"
android:layout_height="0dp"
android:layout_weight="0.2"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/addAlarmBtn"
android:src="#drawable/badge" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width"match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/alarmsLayout" android:orientation="vertical"
android:layout_marginTop="70dp" >
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/addAlarmBtn"
android:src="#drawable/time" />
</RelativeLayout>
</RelativeLayout>
I have an Activity that uses AndroidSlidingUpPanel. Now, everything works perfect. However, I would like to add a ScrollView on my second panel to add the same functionality like Maps or Google Music:
For instance,
When the user has a list of directions, he/she may pull up the drawer and scroll the complete instructions.
Now, my attempt:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<ScrollView
android:id="#+id/card_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<it.gmariotti.cardslib.library.view.CardView
android:id="#+id/food_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true" />
<View
android:layout_width="match_parent"
android:layout_height="15dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eee"
android:clickable="true"
android:focusable="false"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/name_slide"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="10dp"
android:text="#string/slide_up"
android:textSize="14sp" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<it.gmariotti.cardslib.library.view.CardView
android:id="#+id/food_nutrition_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true" />
<View
android:layout_width="match_parent"
android:layout_height="15dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
This, displays fine my content, but does not add the scroll view for the second panel.
What can I do?
Note: According to the documentation of AndroidSlidingUpPanel, there can only be two children under its view. I use a LinearLayout as the second child because its the only way that I have found to display the drawer. For instance, that TextView would be in the place of the content of the estimated time (drawer) from Maps.
Thanks
Height of second scrollview should be android:layout_height="match_parent". Good luck!
take one RelativeLayout in com.sothree.slidinguppanel.SlidingUpPanelLayout and set property layout_above="yoursecondLinearlayout" to First ScrollView and second child LinearLayout to set property alignParentBottom=true. thats it....
See below code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
**<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >**
<ScrollView
android:id="#+id/card_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
**android:layout_above="#+id/linearlayout1"**>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<it.gmariotti.cardslib.library.view.CardView
android:id="#+id/food_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true" />
<View
android:layout_width="match_parent"
android:layout_height="15dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
**android:id="#+id/linearlayout1"**
**android:layout_alignParentBottom="true"**
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eee"
android:clickable="true"
android:focusable="false"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/name_slide"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="10dp"
android:text="#string/slide_up"
android:textSize="14sp" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<it.gmariotti.cardslib.library.view.CardView
android:id="#+id/food_nutrition_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true" />
<View
android:layout_width="match_parent"
android:layout_height="15dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
Fixed it by adding an id to the Parent of the Title, and adding this to my code:
layout.setDragView((LinearLayout) findViewById(R.id.scrolled_view));
New .xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<ScrollView
android:id="#+id/card_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<it.gmariotti.cardslib.library.view.CardView
android:id="#+id/food_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true" />
<View
android:layout_width="match_parent"
android:layout_height="15dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eee"
android:clickable="true"
android:focusable="false"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/scrolled_view"
android:layout_width="match_parent"
android:layout_height="68dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/name_slide"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="10dp"
android:text="#string/slide_up"
android:textSize="14sp" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<it.gmariotti.cardslib.library.view.CardView
android:id="#+id/food_nutrition_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true" />
<View
android:layout_width="match_parent"
android:layout_height="15dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
I have a question about layout android.
This is layout image that i want to make it. Like this:
This is image exmaple:
Here my code:
<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="#drawable/first_screen_bg"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100" >
<LinearLayout
android:id="#id/linerTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="55"
android:background="#color/white"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:id="#id/linerBottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="45"
android:background="#color/grey" >
<LinearLayout
android:id="#id/linerMidle"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="top|center"
android:background="#color/black" >
</LinearLayout>
<RelativeLayout
android:id="#id/linerFlag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="-20dp"
android:background="#drawable/login_flag" >
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout><RelativeLayout>
</RelativeLayout>
But it not running.
Please help me. Thanks
change yout layout.xml to this:
<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="#drawable/first_screen_bg"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100" >
<LinearLayout
android:id="#id/linerTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="55"
android:background="#color/white"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:id="#id/linerBottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="45"
android:background="#color/grey" >
<LinearLayout
android:id="#id/linerMidle"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="top|center"
android:background="#color/black" >
</LinearLayout>
<RelativeLayout
android:id="#id/linerFlag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="-20dp"
android:background="#drawable/login_flag" >
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
I need result as this.
My xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include layout="#layout/background_water"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<include layout="#layout/finish_order_content"/>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/sendOrder"
android:text="Оформить заказ"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="8dp"
android:background="#drawable/btn_orange"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
If ScrollView have a very long content then Button not show (I see only ScrollView). How to fix it?
You can do something like below. Add android:layout_above="#id/sendOrder" to ScrollView to make it appear above the button and set its height fill_parent to fill the available space.
I'm not sure how <include layout="#layout/background_water"/> should work though as you haven't included it in the picture above.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="#+id/sendOrder"
android:text="Оформить заказ"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="8dp"
android:background="#drawable/btn_orange"/>
<include layout="#layout/background_water"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#id/sendOrder">
<include layout="#layout/finish_order_content"/>
</ScrollView>
</RelativeLayout>
// try this way
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/background_water"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/finish_order_content"/>
</ScrollView>
</LinearLayout>
<Button
android:id="#+id/sendOrder"
android:text="Оформить заказ"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="8dp"
android:background="#drawable/btn_orange"/>
</LinearLayout>
Try this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include layout="#layout/background_water"/>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<include layout="#layout/finish_order_content"/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="0dp"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp" >
<Button
android:id="#+id/sendOrder"
android:text="Оформить заказ"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="8dp"
android:background="#drawable/btn_orange"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
The below should work. I took the liberty of removing unnecessary Views. Not sure what background_water actually is, but if it is supposed to be used as background, just remove your include (and the android:layout_below part I added to your ScrollView), and use android:background on the main RelativeLayout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include layout="#layout/background_water"
android:id="#+id/include_layout"/>
<Button
android:id="#+id/sendOrder"
android:text="Оформить заказ"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="8dp"
android:background="#drawable/btn_orange"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/sendOrder"
android:layout_below="#id/include_layout">
<include layout="#layout/finish_order_content"/>
</ScrollView>
</RelativeLayout>
Just try this once ,put below code in xml file and view its preview .
I hope this will help u or atleast provides u a clue :
<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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/button"
android:layout_marginBottom="10dip"
android:background="#bb9789" >
</ScrollView>
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ff6790"
android:gravity="center"
android:text="Button" />
</RelativeLayout>
value of
activity_vertical_margin
is
16dip