How to put a button between two layouts - android

I want to put a normal button between two layouts as showing in image.
I do not want to use floating button and coordinator layout.
Is it possible by relative layout ?
Demo Image
I am using following xml file to do it.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10" >
<fragment
android:id="#+id/mapForPlannedRide"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="3.5" />
<LinearLayout
android:id="#+id/planned_detail_layout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="6.5"
android:background="#color/text_white"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:id="#+id/departure_layout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="2.5"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/departure"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/departure"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="dfg ddfghd dfdg"
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".03"
android:background="#color/line_color" />
<LinearLayout
android:id="#+id/destination_layout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="2.5"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/destination"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/destination"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Dilshad Garden Delhi"
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".03"
android:background="#color/line_color" />
<LinearLayout
android:id="#+id/date_time_layout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/date_time"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/date_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="10:00 a.m."
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".03"
android:background="#color/line_color" />
<LinearLayout
android:id="#+id/chosen_vehicle_layout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/chosen_vehicle"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/chosen_vehicle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Dus One"
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

I have tried this check below code using RelativeLayout :
<?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:orientation="vertical">
<fragment
android:id="#+id/mapForPlannedRide"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="180dp" />
<LinearLayout
android:id="#+id/departure_layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_below="#+id/mapForPlannedRide"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/departure"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/departure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dfg ddfghd dfdg"
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".03"
android:background="#color/line_color" />
<LinearLayout
android:id="#+id/destination_layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_below="#+id/departure_layout"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/destination"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/destination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dilshad Garden Delhi"
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".03"
android:background="#color/line_color" />
<LinearLayout
android:id="#+id/date_time_layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_below="#+id/destination_layout"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/date_time"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/date_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="10:00 a.m."
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".03"
android:background="#color/line_color" />
<LinearLayout
android:id="#+id/chosen_vehicle_layout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_below="#+id/date_time_layout"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/passenger" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/chosen_vehicle"
android:textSize="#dimen/text_size17sp" />
<TextView
android:id="#+id/chosen_vehicle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dus One"
android:textSize="#dimen/text_size14sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="100dp"
android:layout_height="50"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_marginRight="20dp"
android:layout_marginTop="150dp"
android:src="#android:drawable/ic_reminder" />
</RelativeLayout>

Related

Why is this layout not looking the way it is supposed to?

I have a little bit issue here.
layout which i have been designed in photoshop looks like below
and the layout which i design in xml look like below:
So, you see that for some reason, the edittexts look very off.here is the full XML code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#1fed7b">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:layout_weight="114"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_headline" />
</LinearLayout>
<LinearLayout
android:gravity="top"
android:orientation="horizontal"
android:layout_weight="281"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="547"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_subline1" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="wrap_content">
<EditText
android:id="#+id/txt_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:gravity="center"
android:hint="00"
android:inputType="number"
android:maxLength="2"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<TextView
android:text=":"
android:layout_gravity="top"
android:gravity="center_vertical"
android:id="#+id/txt_colon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<EditText
android:id="#+id/txt_minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:gravity="center_vertical"
android:hint="00"
android:inputType="number"
android:maxLength="2"
android:singleLine="true"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<LinearLayout
android:gravity="left"
android:orientation="horizontal"
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:text="00"
android:layout_gravity="left"
android:gravity="bottom"
android:id="#+id/txt_seconds"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="189"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="160"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="140"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:text="hh"
android:layout_gravity="left"
android:gravity="top"
android:id="#+id/txt_hh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="110"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="140"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:text="mm"
android:layout_gravity="right"
android:gravity="top"
android:id="#+id/txt_mm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="160"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="250"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_playstore"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_playstore" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_random"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_random" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="15"
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_facebook"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_fb" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_start"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_start" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="209"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:id="#+id/btn_skip"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_skip" />
</LinearLayout>
</LinearLayout>
I know, it is a lot of code, but I really need your help here. Can you do me a favor and look through it? That be so awesome!!!
Thank you!
here is solution for your problem,copy and past code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#1fed7b">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:layout_weight="114"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_headline" />
</LinearLayout>
<LinearLayout
android:gravity="top"
android:orientation="horizontal"
android:layout_weight="281"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="547"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_subline1" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="90dp"
android:layout_height="match_parent"
android:orientation="vertical"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/txt_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:hint="00"
android:inputType="number"
android:maxLength="2"
android:layout_weight="1"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<TextView
android:id="#+id/txt_colon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="center"
android:text=":"
android:layout_weight="2"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<EditText
android:id="#+id/txt_minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:layout_weight="1"
android:hint="00"
android:gravity="right"
android:inputType="number"
android:maxLength="2"
android:singleLine="true"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:orientation="horizontal">
<TextView
android:id="#+id/txt_mm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:text="mm"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
<TextView
android:id="#+id/txt_hh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="right"
android:text="hh"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="90dp"
android:layout_height="match_parent"
>
<TextView
android:id="#+id/txt_seconds"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="00"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="250"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_playstore"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_playstore" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_random"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_random" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="15"
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_facebook"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_fb" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_start"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_start" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="209"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:id="#+id/btn_skip"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_skip" />
</LinearLayout>
</LinearLayout>
hope this will solve your problem

Unable to place a layout at the bottom after scroll view

I am unable to place a layout at the bottom after a scroll view. Please help.
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal" />
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
android:gravity="bottom">
<LinearLayout
android:id="#+id/linear_call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector">
<ImageView
android:id="#+id/btn_phone_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/call_us_tab"/>
<TextView
android:id="#+id/call"
android:textColor="#android:color/white"
android:text="Call Us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_message"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/message_tab"
/>
<TextView
android:id="#+id/msg"
android:textColor="#android:color/white"
android:text="Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:background="#drawable/list_selector"
android:padding="8dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/share_tab"/>
<TextView
android:id="#+id/share"
android:textColor="#android:color/white"
android:text="Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:padding="5dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none"
android:layout_above="#+id/bottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/tv_name_detail_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/tv_map"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Map"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"/>
</RelativeLayout>
<TextView
android:id="#+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RatingBar
android:layout_marginTop="2dp"
android:id="#+id/rating_bar_pro_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
style="#style/foodRatingBar"/>
<TextView
android:id="#+id/tv_nearby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
<TextView
android:layout_marginTop="5dp"
android:id="#+id/tv_specialization"
android:text="Specialization: "
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ListView
android:id="#+id/list_specialization"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/tv_education"
android:text="Education:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ListView
android:id="#+id/list_education"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:id="#+id/tv_experiences"
android:layout_marginTop="5dp"
android:text="Experiences:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ListView
android:id="#+id/list_experience"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<!-- The navigation drawer -->
<ListView android:id="#+id/left_drawer"
android:layout_width="260dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#5488B8"
android:dividerHeight="1dp"
android:background="#00427F"
android:listSelector="#drawable/list_selector"
/>
</android.support.v4.widget.DrawerLayout>
Try like this, this will fix your problem.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottom"
android:layout_below="#+id/my_recycler_view"
android:fadingEdgeLength="0dp"
android:fillViewport="true"
android:overScrollMode="never"
android:padding="5dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
Use root layout as RelativeLayout and the view you want to align bottom that's add this line:
android:layout_alignParentBottom="true"
This will solve your issue.
Try this and give your scroll view any variable size rather than wrap_content
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:padding="5dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/tv_name_detail_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"
/>
<TextView
android:id="#+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RatingBar
android:layout_marginTop="2dp"
android:id="#+id/rating_bar_pro_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
style="#style/foodRatingBar"
/>
<TextView
android:id="#+id/tv_nearby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_marginTop="5dp"
android:id="#+id/tv_specialization"
android:text="Specialization: "
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_specialization"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/tv_education"
android:text="Education:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_education"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:id="#+id/tv_experiences"
android:layout_marginTop="5dp"
android:text="Experiences:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_experience"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
>
<LinearLayout
android:id="#+id/linear_call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector">
<ImageView
android:id="#+id/btn_phone_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/call_us_tab"/>
<TextView
android:id="#+id/call"
android:textColor="#android:color/white"
android:text="Call Us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_message"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp"
android:background="#drawable/list_selector"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/message_tab"
/>
<TextView
android:id="#+id/msg"
android:textColor="#android:color/white"
android:text="Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="33"
android:orientation="vertical"
android:gravity="center"
android:background="#drawable/list_selector"
android:padding="8dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/share_tab"/>
<TextView
android:id="#+id/share"
android:textColor="#android:color/white"
android:text="Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
You need to use RelativeLayout instead of LinearLayout at parent and then you can place items up and down to each other like
which view you want below to another view you can use this
android:layout_below="#+id/yourview"
and for view you want above to other you can use this
android:layout_above="#+id/yourview"
here is a sample
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView">
<!-- some stuff in here -->
</LinearLayout>
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
Hope it helps
try this hopefully this is what you wanted
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadingEdgeLength="0dp"
android:overScrollMode="never"
android:scrollbars="horizontal"
/>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="220dp"
android:fadingEdgeLength="0dp"
android:padding="5dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/tv_name_detail_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:text="Name"/>
<TextView
android:id="#+id/tv_address"
android:text="address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RatingBar
android:layout_marginTop="2dp"
android:id="#+id/rating_bar_pro_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
/>
<TextView
android:id="#+id/tv_nearby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_marginTop="5dp"
android:id="#+id/tv_specialization"
android:text="Specialization: "
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_specialization"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/tv_education"
android:text="Education:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_education"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textStyle="bold"
android:id="#+id/tv_experiences"
android:layout_marginTop="5dp"
android:text="Experiences:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_marginTop="5dp"
android:id="#+id/list_experience"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
>
<LinearLayout
android:layout_weight="2"
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:weightSum="3"
>
<LinearLayout
android:id="#+id/linear_call"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:weightSum="3"
android:background="#000000">
<ImageView
android:id="#+id/btn_phone_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/name_top"
android:layout_weight="2"
/>
<TextView
android:id="#+id/call"
android:textColor="#android:color/white"
android:text="Call Us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_message"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:weightSum="2"
android:layout_weight="1"
android:background="#000000"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/name_top"
android:layout_weight="1"
/>
<TextView
android:id="#+id/msg"
android:textColor="#android:color/white"
android:text="Message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#5488B8" />
<LinearLayout
android:id="#+id/linear_share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:background="#000000"
android:weightSum="2"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/name_top"
android:layout_weight="1"
/>
<TextView
android:id="#+id/share"
android:textColor="#android:color/white"
android:text="Share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:layout_weight="3"
android:id="#+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#5488B8"
android:dividerHeight="1dp"
android:background="#00427F"
android:listSelector="#898989"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Please update version of a recyclerview library in gradle file :
compile 'com.android.support:recyclerview-v7:23.2.1'
It should solve your issue.
Due to this issue, wrap_content not used to work on recyclerview before this version.

Google Map Inside viewpager and a vertical scroll view not getting displayed in some devices

I have a viewpager with 5 fragments and one among them is a search fragment with a google map the weired issue is that in some device the map is displayed with no problem but in some device(micromax aq 5000 Kitkat) it's not getting displayed
fragment
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/mainlayerr"
android:orientation="vertical" >
<ScrollView
android:layout_height="wrap_content"
android:layout_width="match_parent"
>
<LinearLayout
android:id="#+id/ll_MenuLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<AutoCompleteTextView
android:id="#+id/txtSearchh"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="#dimen/space_2_5_x"
android:layout_marginRight="#dimen/space_2_5_x"
android:layout_marginTop="#dimen/space_2_5_x"
android:hint="Search"
android:layout_gravity="bottom|left"
android:padding="5dp"
android:background="#null"
android:textColor="#color/markerboxcolor"
/>
<View
android:layout_height="1dp"
android:layout_marginTop="-6dp"
android:layout_width="match_parent"
android:layout_marginLeft="#dimen/space_2_5_x"
android:layout_marginRight="#dimen/space_2_5_x"
android:background="#color/divider_color"
/>
<RelativeLayout
android:id="#+id/search_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/tab2_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="#dimen/space_0_x"
android:layout_centerInParent="true"
android:orientation="horizontal"
android:padding="#dimen/space_2_x" >
<CheckBox
android:id="#+id/checkimage_male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:contentDescription="#string/app_name"
android:text="Male"
android:layout_marginRight="5dp"
android:gravity="center|center_vertical|center_horizontal"
/>
<CheckBox
android:id="#+id/checkimage_female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:text="Female"
android:layout_marginLeft="5dp"
android:contentDescription="#string/app_name"
android:gravity="center|center_vertical|center_horizontal"
/>
</LinearLayout>
</RelativeLayout>
<HorizontalScrollView
android:orientation="horizontal" android:layout_width="wrap_content"
android:id="#+id/horizontalScrolll"
android:layout_margin="10dp"
android:scrollbars="none"
android:background="#C6D7D2" android:layout_height="80dp">
<LinearLayout android:id="#+id/container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="#+id/distance_menu"
android:layout_width="match_parent"
android:layout_height="#dimen/footer_tabs_container_height"
android:layout_below="#+id/sportsViewPager"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/tab3_wrapper"
android:layout_width="0dip"
android:layout_height="#dimen/container_height"
android:layout_gravity="center|center_horizontal|center_vertical"
android:layout_marginRight="#dimen/space_2_x"
android:layout_weight="0.15"
android:orientation="vertical" >
<TextView
android:id="#+id/distance"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/space_2_x"
android:gravity="left|center_horizontal|center_vertical"
android:paddingLeft="#dimen/space_2_x"
android:text="#string/search_dist"
android:textColor="#color/text_color1x"
android:textSize="#dimen/text_size_medium"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:id="#+id/tab4_wrapper"
android:layout_width="0dip"
android:layout_height="#dimen/footer_tabs_container_height"
android:layout_marginRight="#dimen/space_2_x"
android:layout_weight=".5"
android:gravity="center_vertical"
android:orientation="horizontal" >
<com.sportspartners.sportspartners.util.DiscreteSeekBar
android:id="#+id/seekBarr"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="#dimen/space_2_x"
android:paddingRight="#dimen/space_2_x"
app:dsb_allowTrackClickToDrag="false"
app:dsb_indicatorTextAppearance="#style/CustomFloaterTextAppearance"
app:dsb_progressColor="#color/my_progress_color"
app:dsb_rippleColor="#FF7788FF"
app:dsb_indicatorColor="#color/my_floater_color"
app:dsb_indicatorFormatter="%d" />
<TextView
android:id="#+id/progressID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/space_2_x"
android:layout_marginRight="#dimen/space_2_x"
android:text="10 Kms" >
</TextView>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/seprater1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/from_menu"
android:background="#color/blue" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_below="#+id/seprater1"
>
<fragment
android:id="#+id/mappy"
android:layout_width="match_parent"
android:layout_height="400dp"
android:name="com.sportspartners.sportspartners.fragments.search.SearchFragment"
class="com.google.android.gms.maps.MapFragment" />
<View
android:id="#+id/imageView123"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#android:color/transparent" />
</FrameLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<ListView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_margin="5dp"
android:divider="#null"
android:scrollbars="none"
android:id="#+id/searchhList"
android:visibility="gone"
></ListView>
<ImageView
android:id="#+id/progress_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone"
/>
<LinearLayout
android:layout_width="80dp"
android:layout_height="wrap_content"
android:id="#+id/messagenotificationlayout"
android:layout_alignParentRight="true"
android:visibility="gone"
android:layout_alignBottom="#+id/searchhList"
android:descendantFocusability="blocksDescendants"
>
<com.example.floatinglibrary.FloatingActionButton
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/chatterimage"
app:fab_addButtonColorNormal="#00000000"
android:id="#+id/messagenotificationbtn"
android:background="#null"
app:fab_size="normal"
/>
<TextView
android:background="#drawable/blue_circle"
android:id="#+id/messagenotificationbadge"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:paddingRight="5dp"
android:layout_marginLeft="-17dp"
android:layout_marginTop="-20dp"
android:paddingBottom="5dp"
android:layout_height="wrap_content"
android:padding="2sp"
android:clickable="false"
android:text="10"
android:textColor="#color/white"
android:textSize="#dimen/text_size_micro_min"
/>
</LinearLayout>
</RelativeLayout>
parent layout with view pager
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/titlecontainer"
>
<LinearLayout
android:id="#+id/titlbarrSearch"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#color/markerboxcolor"
android:layout_gravity="top"
android:orientation="horizontal"
android:paddingTop="4dp"
android:visibility="gone"
android:gravity="center_vertical"
>
<ImageButton
android:layout_marginLeft="3dp"
android:id="#+id/btnsearchback"
android:src="#drawable/searchback"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:background="#null"
/>
<TextView
android:id="#+id/txttitle"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_gravity="center"
android:text="Search"
android:textColor="#color/pure_white"
android:textSize="#dimen/text_size_large"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/titlbarr"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#color/markerboxcolor"
android:layout_gravity="top"
android:weightSum="5"
android:gravity="center"
>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
>
<TextView
android:id="#+id/txt1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Feed"
android:gravity="center"
android:textColor="#color/tabred"
/>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:background="#color/tabred"
android:id="#+id/view1"
/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
>
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Profile"
android:gravity="center"
android:textColor="#ffffff"
/>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:background="#color/pure_white"
android:id="#+id/view2"
android:visibility="gone"
/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
>
<TextView
android:id="#+id/txt3"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Search"
android:gravity="center"
android:textColor="#ffffff"
/>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:background="#color/pure_white"
android:id="#+id/view3"
android:visibility="gone"
/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
>
<TextView
android:id="#+id/txt4"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Followers"
android:gravity="center"
android:textColor="#ffffff"
/>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:background="#color/pure_white"
android:id="#+id/view4"
android:visibility="gone"
/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
>
<TextView
android:id="#+id/txt5"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Settings"
android:gravity="center"
android:textColor="#ffffff"
/>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:background="#color/pure_white"
android:id="#+id/view5"
android:visibility="gone"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<com.sportspartners.sportspartners.util.MyViewpager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_below="#+id/titlecontainer"
android:layout_height="match_parent" >
<android.support.v4.view.PagerTabStrip
android:id="#+id/pager_headerr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/markerboxcolor"
android:layout_gravity="top"
android:visibility="gone"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:textColor="#ffffff" />
</com.sportspartners.sportspartners.util.MyViewpager>
</RelativeLayout>
Finally I got the answer google map will not show up(in some devices) if it's placed inside a scroll view for that I need to set android:fillViewport="true" inside scroll view this may stop scrolling the map but will show it to a perfect size

Vertical line in XML for notification in Android

I have created a custom notification XML file. I would like to draw a vertical line like the horizontal line in the below picture. I have been trying various ways couldn't achieve it. The orientation in xml from horizontal to vertical didn't help me.
Check my screenshot below:I would like to get the vertical line instead of the red line.
Tried the following code:
<LinearLayout
android:id="#+id/horizontalLayout"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="vertical" >
</LinearLayout>
Below is my XML:
<?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:background="#151515"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/iconimagelayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="5dp" >
<ImageView
android:id="#+id/iconimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/icon"
android:src="#drawable/cancel" />
</LinearLayout>
<LinearLayout
android:id="#+id/NameLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".70"
android:orientation="vertical"
android:paddingLeft="10sp" >
<LinearLayout
android:id="#+id/topTextlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:gravity="center_horizontal"
android:paddingBottom="5dp" >
<TextView
android:id="#+id/topText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="TITLE"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/textLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1C1C1C"
android:paddingTop="5dp" >
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:text="MESSAGE BODY"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout2"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/alldismisslayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E" >
<ImageView
android:id="#+id/dismissicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/dismissicon"
android:src="#drawable/cancel" />
<LinearLayout
android:id="#+id/dismissLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|left" >
<TextView
android:id="#+id/dismissText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="#string/notificationdismiss"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Not sure where exactly I have to put the vertical line code.
You can use following to create the vertical line.
<View
android:layout_width="4dip"
android:layout_height="match_parent"
android:background="#FF000000"/>
Put this code after your first cancel imageview.So that your final code becomes
<LinearLayout
android:id="#+id/iconimagelayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="5dp" >
<ImageView
android:id="#+id/iconimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/icon"
android:src="#drawable/cancel" />
</LinearLayout>
<View
android:layout_width="4dip"
android:layout_height="match_parent"
android:background="#FF000000"/>
<LinearLayout
android:id="#+id/NameLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".70"
android:orientation="vertical"
android:paddingLeft="10sp" >
<LinearLayout
android:id="#+id/topTextlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:gravity="center_horizontal"
android:paddingBottom="5dp" >
<TextView
android:id="#+id/topText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="TITLE"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/textLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1C1C1C"
android:paddingTop="5dp" >
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:text="MESSAGE BODY"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout2"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/alldismisslayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E" >
<ImageView
android:id="#+id/dismissicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/dismissicon"
android:src="#drawable/cancel" />
<LinearLayout
android:id="#+id/dismissLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|left" >
<TextView
android:id="#+id/dismissText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="#string/notificationdismiss"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Hope it helps.
Just use proper backgrounds and margin if you need
Here is the screenshot
XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#151515"
android:baselineAligned="false"
>
<ImageView
android:id="#+id/iconimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/topText"
android:contentDescription="string/icon"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/topText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:layout_centerHorizontal="true"
android:text="TITLE"
android:textColor="#FFFFFF"
android:textSize="18sp" />
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:layout_below="#+id/topText"
android:layout_toRightOf="#+id/iconimage"
android:layout_margin="10dp"
android:background="#1C1C1C"
android:text="MESSAGE BODY"
android:textColor="#FFFFFF"
android:textSize="18sp" />
<ImageView
android:id="#+id/dismissicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/text"
android:layout_toRightOf="#+id/iconimage"
android:contentDescription="string/dismissicon"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/dismissText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_toRightOf="#+id/dismissicon"
android:layout_below="#+id/text"
android:background="#2E2E2E"
android:text="notificationdismiss"
android:textColor="#FFFFFF"
android:textSize="18sp" />
<TextView android:layout_width="2dp"
android:layout_height="wrap_content"
android:background="#ff0000"
android:layout_alignRight="#+id/iconimage"
android:layout_alignBottom="#+id/dismissicon"
android:layout_alignTop="#+id/topText"
/>
</RelativeLayout>
hey try this with less layout hierarchy
<?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="wrap_content"
android:background="#1C1C1C"
android:baselineAligned="false"
android:orientation="horizontal" >
<ImageView
android:id="#+id/iconimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/cancel" />
<View
android:layout_width="3dp"
android:layout_height="fill_parent"
android:layout_marginLeft="3dp"
android:background="#color/GREEN" />
<LinearLayout
android:id="#+id/NameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/topTextlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:gravity="center_horizontal"
android:paddingBottom="5dp" >
<TextView
android:id="#+id/topText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="5dp"
android:text="TITLE"
android:textColor="#color/WHITE"
android:textSize="18sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="3dp"
android:background="#color/your_color" />
<LinearLayout
android:id="#+id/textLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1C1C1C"
android:paddingTop="5dp" >
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:text="MESSAGE BODY"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="3dp"
android:background="#color/GREEN" />
<LinearLayout
android:id="#+id/alldismisslayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E" >
<TextView
android:id="#+id/dismissText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/cancel"
android:drawablePadding="5dp"
android:paddingLeft="5dp"
android:text="#string/notificationdismiss"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
Try this way,hope this will help you to solve your problem.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#151515"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/iconimagelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingLeft="5dp" >
<ImageView
android:id="#+id/iconimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/icon"
android:src="#drawable/ic_launcher" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#FF0000"/>
<LinearLayout
android:id="#+id/NameLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp">
<LinearLayout
android:id="#+id/topTextlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:gravity="center_horizontal"
android:padding="10dp">
<TextView
android:id="#+id/topText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TITLE"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/textLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1C1C1C"
android:padding="10dp">
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MESSAGE BODY"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/alldismisslayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:gravity="center">
<ImageView
android:id="#+id/dismissicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/dismissicon"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:id="#+id/dismissLayout"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center"
android:paddingLeft="5dp">
<TextView
android:id="#+id/dismissText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/notificationdismiss"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Try This:
Create one colored vertical line 9 patch image
then use that image in View in android xml file
Change your XML file like:
<?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:background="#151515"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/iconimagelayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginRight="10dp"
android:paddingLeft="5dp" >
<ImageView
android:id="#+id/iconimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="icon"
android:src="#drawable/ic_launcher" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#drawable/untitled" />
</LinearLayout>
<LinearLayout
android:id="#+id/NameLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".70"
android:orientation="vertical"
android:paddingLeft="10sp" >
<LinearLayout
android:id="#+id/topTextlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E"
android:gravity="center_horizontal"
android:paddingBottom="5dp" >
<TextView
android:id="#+id/topText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="TITLE"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/textLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1C1C1C"
android:paddingTop="5dp" >
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:text="MESSAGE BODY"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/horizontalLayout2"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#000000"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/alldismisslayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2E2E2E" >
<ImageView
android:id="#+id/dismissicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="dismissicon"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:id="#+id/dismissLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|left" >
<TextView
android:id="#+id/dismissText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="notificationdismiss"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Here in:
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#drawable/untitled" />
untitled is my 9 patch image.
9 patch image because it could be stretched as per the screen resolution

Android Button Place Image in center and text at bottom

I want to place Image in the center and text just below it in a button, I tried to set android:gravity but could not set it properly,here is the image attached:
below is my xml:
<?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"
android:paddingLeft="10.0dip"
android:paddingTop="10.0dip"
android:paddingRight="10.0dip"
android:paddingBottom="10.0dip"
android:background="#drawable/background_img"
>
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="10.0dip"
android:paddingTop="10.0dip"
android:paddingRight="10.0dip"
android:paddingBottom="10.0dip"
>
<Button
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:id="#+id/button_listen"
android:text="#string/listen"
android:drawableTop="#drawable/listen_btn"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center"
/>
<Button
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:id="#+id/button_gallery"
android:text="#string/gallery"
android:drawableTop="#drawable/gallery_btn"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center"
/>
</LinearLayout>
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="10.0dip"
android:paddingTop="10.0dip"
android:paddingRight="10.0dip"
android:paddingBottom="10.0dip"
>
<Button
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:id="#+id/button_play"
android:text="#string/play"
android:drawableTop="#drawable/play_btn"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
/>
<Button
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:id="#+id/button_find"
android:text="#string/find"
android:drawableTop="#drawable/test_btn"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center"
/>
</LinearLayout>
</LinearLayout>
What is the proper way to center the image and text below it?
Many thanks in advance.
Try this its work for me
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="151dp"
android:onClick="onClick"
android:drawableTop="#drawable/ic_launcher"
android:text="Button" />
</RelativeLayout>
Try change the button to LinearLayout and use same onclicklistener on fakebutton
<LinearLayout
android:id="#+id/fakeButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_big_evento" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/menu_about" />
</LinearLayout>
I followed DjHacktorReborn comments and made the layout, here is the freezed one
<?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:background="#drawable/background_img"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4.1"
android:orientation="vertical" >
</LinearLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal"
android:stretchColumns="*" >
<TableRow android:layout_weight="1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/button_listen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="#drawable/main_list"
android:paddingTop="90dp"
android:text="#string/listen"
android:textStyle="bold"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/main_icon_content_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/listen_btn" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/button_gallery"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/main_list"
android:paddingTop="90dp"
android:text="#string/gallery"
android:textStyle="bold"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/main_icon_schedule_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/gallery_btn" />
</RelativeLayout>
</TableRow>
<TableRow android:layout_weight="1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/button_play"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/main_list"
android:ellipsize="marquee"
android:paddingTop="90dp"
android:text="#string/play"
android:textStyle="bold"
android:textColor="#FFFFFF"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/play_btn" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/button_find"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/main_list"
android:paddingTop="90dp"
android:text="#string/find"
android:textStyle="bold"
android:textColor="#FFFFFF" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/test_btn" />
</RelativeLayout>
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4.1"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</LinearLayout>
Here is the updated result
Thanks for the suggestions

Categories

Resources