Nested Scroll Effect in android with backward compativility - java

https://www.youtube.com/watch?v=if9qBW_nIxM&feature=youtu.be
i am working on Scrolling effect like default android calling App in lollipop.but i am not able to get smoothness like in default app.i am posted a link please check it.This is what i have achieved .
<?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:ripple="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_city_selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:minHeight="?attr/actionBarSize"
android:visibility="gone"
app:popupTheme="#style/Theme.AppCompat.Light.DarkActionBar"
app:theme="#style/Toolbar" />
<LinearLayout
android:id="#+id/wrap_total_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/home_search_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="17dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="#+id/show_fav_ripple"
android:background="#drawable/searchview_rounded"
android:orientation="horizontal" >
<ImageView
android:id="#+id/search"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:scaleType="fitXY"
android:src="#drawable/search" />
<EditText
android:id="#+id/search_outlet_edittxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#ffffff"
android:cursorVisible="false"
android:hint="Search for outlets"
android:singleLine="true" />
<ImageView
android:id="#+id/menu_overlay_txt"
android:layout_width="25dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:gravity="center_vertical"
android:src="#drawable/more" />
</LinearLayout>
<com.competent.groove.thegroove.utils.RippleView
android:id="#+id/show_fav_ripple"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="17dp"
app:rv_framerate="10"
app:rv_rippleDuration="400"
ripple:rv_type="rectangle"
ripple:rv_zoom="true" >
<ImageView
android:id="#+id/show_fav_txt"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/star" />
</com.competent.groove.thegroove.utils.RippleView>
</RelativeLayout>
<LinearLayout
android:id="#+id/pp_seacrh_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_marginTop="15dp"
android:background="#drawable/searchview_rounded"
android:orientation="horizontal"
android:visibility="gone"
>
<ImageView
android:id="#+id/pp_search_img"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:scaleType="fitXY"
android:src="#drawable/search" />
<EditText
android:id="#+id/pp_search_outlet_edittxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#ffffff"
android:cursorVisible="true"
android:hint="Search for outlets"
android:enabled="true"
android:focusable="true"
android:singleLine="true" />
<ImageView
android:id="#+id/pp_menu_overlay_txt"
android:layout_width="25dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:gravity="center_vertical"
android:src="#drawable/more" />
</LinearLayout>
<com.competent.groove.thegroove.utils.RippleView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:rv_framerate="10"
app:rv_rippleDuration="400"
ripple:rv_type="rectangle"
ripple:rv_zoom="true" >
<TextView
android:id="#+id/select_city_txt"
android:layout_width="match_parent"
android:layout_height="38dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_marginTop="15dp"
android:background="#drawable/city_selector_curve"
android:gravity="center"
android:text="I am in CHANDIGARH" />
</com.competent.groove.thegroove.utils.RippleView>
<LinearLayout
android:id="#+id/pp_main_fragment_header"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#color/blue"
android:visibility="gone"
android:orientation="horizontal" >
<TextView
android:id="#+id/pp_top_header"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="PARTY PARTNER"
android:textColor="#color/white"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<com.google.samples.apps.iosched.ui.widget.SlidingTabLayout
android:id="#+id/sliding_tabs"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#color/blue" />
<TextView
android:id="#+id/home_dots_txtview"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:background="#color/blue"
android:gravity="center"
android:paddingRight="8dp"
android:text="D"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/header" />
</LinearLayout>
my requirement is

Related

How to add a scroll view in an Android app

I want to add scroll in my XML without editing the following code. Is there any way of adding it in the following XML? I tried by adding Scroll view and then linear view but it makes the view cut. Is there any way of making it better, I have searched other repository but I didn't find a solution.
<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"
tools:context=".Activity.BookSeatsActivity"
android:orientation="vertical"
android:weightSum="12"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:weightSum="5"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/wheel"
android:src="#drawable/mywheel"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="17dp"
/>
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/grid"
android:layout_marginTop="10dp"
android:layout_below="#+id/wheel"
android:padding="1dp"
android:numColumns="5"
/>
</RelativeLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".4"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".6"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:weightSum="3"
android:layout_marginEnd="10dp"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/seat_open"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:text="Available"
android:paddingStart="5dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/seat_booked"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:text="Unavailable"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/seat_selected"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:paddingStart="5dp"
android:gravity="center_vertical"
android:text="Selected"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:orientation="horizontal"
android:layout_marginStart="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Seat Selected : "
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:textColor="#android:color/black"
android:textStyle="bold"
android:fontFamily="#font/montserrat_regular"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tv_seat_selected"
android:textStyle="bold"
android:textColor="#android:color/black"
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:gravity="center_vertical"
android:layout_marginTop="10dp"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="0dp"
android:layout_weight="1"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/bt_booking_details"
android:textStyle="bold"
android:textColor="#android:color/white"
android:textSize="17dp"
android:layout_margin="10dp"
android:text="Enter Booking Details"
android:fontFamily="#font/montserrat_regular"
android:background="#drawable/circular_button"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Please use the below code snippet for the XML file and change the image view as per your needs.
<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:weightSum="12"
tools:context=".MainActivity">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_weight="8"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:weightSum="5">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="3">
<ImageView
android:id="#+id/wheel"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="17dp"
android:layout_marginRight="17dp"
android:src="#drawable/sports" />
<GridView
android:id="#+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/wheel"
android:layout_marginTop="10dp"
android:numColumns="5"
android:padding="1dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".4" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_weight=".6"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/toys" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:text="Available" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/mobile" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:text="Unavailable" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/home" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:text="Selected" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:padding="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:text="Seat Selected : "
android:textColor="#android:color/black"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_seat_selected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:padding="5dp"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:textColor="#android:color/black"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_weight="1">
<Button
android:id="#+id/bt_booking_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Enter Booking Details"
android:textColor="#android:color/white"
android:textSize="17dp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Please try the following code, I just changed the scroll view to be match_parent for width and height and the linear layout to be match_parent for width& wrap_content for height.
Please note that this view won't scroll till you run it on a small screen device.
and please change the images as you need.
<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"
tools:context=".MainActivity"
android:orientation="vertical"
android:weightSum="12">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:weightSum="5"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:id="#+id/wheel"
android:src="#drawable/ic_launcher_background"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="17dp"
/>
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/grid"
android:layout_marginTop="10dp"
android:layout_below="#+id/wheel"
android:padding="1dp"
android:numColumns="5"
/>
</RelativeLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".4"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".6"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:weightSum="3"
android:layout_marginEnd="10dp"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/ic_launcher_background"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:text="Available"
android:paddingStart="5dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/ic_launcher_background"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:text="Unavailable"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:weightSum="2"
android:orientation="horizontal"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight=".5"
android:src="#drawable/ic_launcher_background"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1.5"
android:paddingStart="5dp"
android:gravity="center_vertical"
android:text="Selected"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:orientation="horizontal"
android:layout_marginStart="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Seat Selected : "
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:textColor="#android:color/black"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tv_seat_selected"
android:textStyle="bold"
android:textColor="#android:color/black"
android:textSize="18dp"
android:padding="5dp"
android:paddingStart="10dp"
android:gravity="center_vertical"
android:layout_marginTop="10dp"
/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="0dp"
android:layout_weight="1"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/bt_booking_details"
android:textStyle="bold"
android:textColor="#android:color/white"
android:textSize="17dp"
android:layout_margin="10dp"
android:text="Enter Booking Details"
android:background="#drawable/ic_launcher_background"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

OnTouch listener not working in relativelayout which included mapfragment

in fragment i need to implement ontouch listener to relativelayout which included map fragment and i have made layouts as when i click map button mapview visible, same as done with listview. i have to detect when user touch over map, also i made ontouch for partmap layout which doesn't work.anyone plz.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/partMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"
android:layout_above="#+id/footer"
android:alpha="0.0">
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
<RelativeLayout
android:id="#+id/R_noPropertiesMatchMap"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_above="#+id/footer"
android:layout_marginTop="5dp"
android:alpha="0.5"
android:background="#000000"
android:padding="10dp"
android:visibility="gone" >
<TextView
android:id="#+id/tv1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="No properties match your search"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv1"
android:gravity="center_horizontal"
android:text="Please change the zoom or your filters"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/R_noOnlyUS"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_above="#+id/footer"
android:alpha="0.5"
android:background="#000000"
android:padding="10dp"
android:visibility="gone">
<TextView
android:id="#+id/tv3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Invalid address"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold"
/>
<TextView
android:id="#+id/tv4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv3"
android:gravity="center_horizontal"
android:text="Realy is only available in the US"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/R_notgeoloc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:alpha="0.5"
android:background="#000000"
android:layout_above="#+id/footer"
android:padding="10dp"
android:visibility="gone" >
<TextView
android:id="#+id/tv3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Oops! We are unable to find your location."
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv3"
android:gravity="center_horizontal"
android:text="Please check your system preferences to make sure geolocation is enabled."
android:textColor="#FFFFFF"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>`<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/partone"
android:layout_above="#+id/footer"
>
<ListView
android:id="#+id/lv_listing"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#null"
android:drawSelectorOnTop="true"
android:scrollbars="none"
/>
<ProgressBar
android:id="#+id/R_Loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/footer"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:visibility="gone"/>
<LinearLayout
android:id="#+id/L_no_fav_homes"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footer"
android:orientation="vertical"
android:paddingTop="30dp"
android:visibility="gone"
android:weightSum="10" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8" >
<ImageView
android:id="#+id/iv_no_fav_homes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:contentDescription="#string/app_name"
android:src="#drawable/no_homes" />
<TextView
android:id="#+id/tv_fav_properties"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iv_no_fav_homes"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="No properties match your search"
android:textColor="#78797B"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_facebookmessage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_fav_properties"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Please change your filters"
android:textColor="#ADAEB0"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2" >
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/L_out_us"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_above="#+id/footer"
android:paddingTop="30dp"
android:visibility="gone"
android:weightSum="10" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8" >
<ImageView
android:id="#+id/iv_no_us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:contentDescription="#string/app_name"
android:src="#drawable/out_usa" />
<TextView
android:id="#+id/text_error"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iv_no_us"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Invalid address"
android:textColor="#78797B"
android:textSize="20sp" />
<TextView
android:id="#+id/text_error_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/text_error"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Realy is only available in the US"
android:textColor="#ADAEB0"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2" >
<Button
android:id="#+id/tv_startsearching_clear"
style="#style/btnStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_margin="8dp"
android:layout_marginTop="100dp"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Clear filter"
android:textColor="#ffffff"
android:textSize="20sp"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/L_notgeoloc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_above="#+id/footer"
android:paddingTop="30dp"
android:visibility="gone"
android:weightSum="10" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:contentDescription="#string/app_name"
android:src="#drawable/notgeoloc" />
<TextView
android:id="#+id/text_error45"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iv_no_us"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Oops! We are unable to find your location."
android:textColor="#78797B"
android:textSize="20sp" />
<TextView
android:id="#+id/text_error_3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/text_error"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Please check your system preferences to make sure geolocation is enabled."
android:textColor="#ADAEB0"
android:textSize="18sp" />
</LinearLayout>
<FrameLayout
android:id="#+id/Footer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="#006AA8"
android:orientation="horizontal"
android:layout_gravity="center_horizontal|bottom">
<TextView
android:id="#+id/ShowMap"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="10dp"
android:gravity="center"
android:clickable="true"
android:text="Map"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:layout_gravity="right|center_vertical" />
<TextView
android:id="#+id/ShowNearby"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="10dp"
android:gravity="center"
android:text="Nearby"
android:clickable="true"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:layout_gravity="left|center_vertical" />
<TextView
android:id="#+id/ClearFilters"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="10dp"
android:gravity="center"
android:text="Clear filters"
android:clickable="true"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:visibility="gone"
android:layout_gravity="center" />
</FrameLayout>
</FrameLayout></RelativeLayout>`

Align the Button to center Background

I need to align the Button of the background. I need the output like the attached image. Button all should have to be aligned to center of the Blue background not the Logo.
<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/feedback_bg" >
<RelativeLayout
android:id="#+id/Frame_title"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<View
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_height="75dp"
android:background="#drawable/topbluebar_and" />
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/alrimal_top_logo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_toRightOf="#id/logo"
android:text="adfadf" />
</RelativeLayout>
</RelativeLayout>
Hey checkout this if it helps you
<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/holo_blue_bright" >
<RelativeLayout
android:id="#+id/Frame_title"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_toRightOf="#+id/logo_linear"
android:layout_height="75dp"
android:gravity="center|center_vertical"
android:background="#android:color/white" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="adfadf" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:id="#+id/logo_linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#drawable/icon" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
check this out..Worked perfectly in my case
<RelativeLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:background="#drawable/topbluebar_and" >
<LinearLayout
android:id="#+id/loginLayout"
android:layout_width="50dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:background="#035125"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="#+id/loginImage"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginLeft="13dp"
android:layout_weight=".3"
android:src="#drawable/login_header" />
</LinearLayout>
<LinearLayout
android:id="#+id/aboutLayout"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:layout_toLeftOf="#+id/loginLayout"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="#+id/aboutImage"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".3"
android:src="#drawable/about" />
<TextView
android:id="#+id/aboutbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".7"
android:text="#string/about"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/syncLayout"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:layout_toLeftOf="#+id/aboutLayout"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="#+id/syncImage"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".3"
android:src="#drawable/sync" />
<TextView
android:id="#+id/synbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".7"
android:text="#string/sync"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/historyLayout"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:layout_toLeftOf="#+id/syncLayout"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="#+id/historyImage"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".3"
android:src="#drawable/history" />
<TextView
android:id="#+id/historybtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".7"
android:text="#string/history"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/resourcesLayout"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:layout_toLeftOf="#+id/historyLayout"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="#+id/resourcesImage"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".3"
android:src="#drawable/resources" />
<TextView
android:id="#+id/resourcesbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".7"
android:text="#string/resources"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#android:color/white" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="#+id/logoImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="15dp"
android:src="#drawable/alrimal_top_logo" />

Aligning buttons to buttom of screen LinearLayout

I have this layout:
<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:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="66dp"
android:layout_height="64dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/office_girl" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/greetingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Boss,"
android:textStyle="bold" />
<TextView
android:id="#+id/dailyStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="What to say if someone call?" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- android:layout_gravity="center" -->
<EditText
android:id="#+id/suto_sms_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:hint="Text"
android:inputType="textMultiLine"
android:lines="3" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_phone_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Phone Status"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Spinner
android:id="#+id/spinner_phone_status"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_busy_until"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="until"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Button
android:enabled="true"
android:id="#+id/button_set_date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="30dp"
android:text="#string/set_time" />
<TextView
android:enabled="true"
android:id="#+id/text_date_and_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="40dp"
android:textSize="12sp"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="#+id/button_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="#string/button_confirm" />
<Button
android:id="#+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="3dp"
android:text="#string/button_cancel" />
</LinearLayout>
</LinearLayout>
This is part of the output:
My question is how to align my Confirm and Cancel buttons (last part of the xml) to buttom of the screen?
I saw examples of how it can be done using relative layout, but my xml is quite big and i dont want to have to change it to relative layout as it will mean lots of work.
Thanks.
Try this code
<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:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.9"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="66dp"
android:layout_height="64dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/greetingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Boss,"
android:textStyle="bold" />
<TextView
android:id="#+id/dailyStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="What to say if someone call?" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- android:layout_gravity="center" -->
<EditText
android:id="#+id/suto_sms_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:hint="Text"
android:inputType="textMultiLine"
android:lines="3" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_phone_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:text="Phone Status"
android:textSize="20sp" />
<Spinner
android:id="#+id/spinner_phone_status"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_busy_until"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:text="until"
android:textSize="20sp" />
<Button
android:id="#+id/button_set_date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="3dp"
android:enabled="true"
android:text="set_time" />
<TextView
android:id="#+id/text_date_and_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="3dp"
android:enabled="true"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.025"
android:baselineAligned="true"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/button_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="confirm" />
<Button
android:id="#+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cancel" />
</LinearLayout>
And here your using lot of LinearLayouts but personally i recommend you to try out relativelayout
Use the android:layout_gravity="bottom" attribute on the buttons as well as their containing LinearLayout.
Add
android:layout_weight="1"
in second last LinearLayout and
android:layout_weight="0"
in last LinearLayout. Hope this work for you.
It's actually very easy to use the RelativeLayout, because you can be very smart about it. For example, wrap it around everything, so that your current parent linear layout will be the first child, end put the linear layout with the buttons at outside of the current parent with the parameter alignParentBottom
Please see this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="66dp"
android:layout_height="64dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/plus" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/greetingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Boss,"
android:textStyle="bold" />
<TextView
android:id="#+id/dailyStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="What to say if someone call?" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- android:layout_gravity="center" -->
<EditText
android:id="#+id/suto_sms_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:hint="Text"
android:inputType="textMultiLine"
android:lines="3" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_phone_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Phone Status"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Spinner
android:id="#+id/spinner_phone_status"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_busy_until"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="until"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Button
android:enabled="true"
android:id="#+id/button_set_date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="30dp"
android:text="set_time" />
<TextView
android:enabled="true"
android:id="#+id/text_date_and_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="40dp"
android:textSize="12sp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="#+id/button_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="confirm" />
<Button
android:id="#+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="3dp"
android:text="cancel" />
</LinearLayout>
</RelativeLayout>

Remove spaces between bottom layout and scrollview in android

Below is the xml code ....
Friends Help me how to avoid space between scrollview and bottomLayout
Xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/addNewEventsCommonbg" >
<TextView
android:id="#+id/addNewEventsTitle"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentTop="true"
android:background="#drawable/dialog_title_bg"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvents"
android:textColor="#color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/addNewEventsTitleName"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_below="#+id/addNewEventsTitle"
android:background="#color/addNewEventsTitleNamebg"
android:drawableLeft="#drawable/mail_sent_icon"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvent"
android:textColor="#color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottomLayout"
android:layout_below="#+id/addNewEventsTitleName" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/addNewEventsEventLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvent"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsName"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsDateTimeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/addNewEventsDate"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<TextView
android:id="#+id/addNewEventsDate"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="#drawable/wedding_date_bg"
android:gravity="center"
android:text="#string/setDate"
android:textColor="#color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="#string/AddNewEventsTime"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<TextView
android:id="#+id/addNewEventsTime"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="#drawable/wedding_date_bg"
android:gravity="center"
android:text="#string/setTime"
android:textColor="#color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsAddressLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/address"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsAddress"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsAddressHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textPostalAddress"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsContactLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventContact"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsContacts"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsPhoneFaxLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventsPhone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsPhone"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:inputType="phone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="#string/AddNewEventsFax"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsFax"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:inputType="text|phone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsEmailLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/email"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsEmail"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEmailAddress"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsWebsiteLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventsWebsite"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsWebsite"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEditText"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<EditText
android:id="#+id/AddNewEventsComments"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsCommentsHeight"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:gravity="left"
android:inputType="textMultiLine"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottomLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="#+id/addNewEventsCancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/cancel_btn_selector"
android:text="#string/cancel"
android:textColor="#color/whiteColor"
android:textSize="18sp" />
<Button
android:id="#+id/addNewEventsSaveBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#drawable/save_btn_selector"
android:text="#string/save"
android:textColor="#color/whiteColor"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"// Gained the whole vertical space
android:layout_weight="1" // Adding weight makes another layout fix and adjustable after these
android:layout_above="#+id/bottomLayout"
android:layout_below="#+id/addNewEventsTitleName" >
Hope these might work!

Categories

Resources