I want to add backbutton and a divider on my header and i have already used linear layout is there any way to do this without major changes in code ? Below is screenshot and code :
BackButton and Divider code :
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/back"/>
<ImageView
android:id="@+id/backdivider"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_toRightOf="@+id/back"
android:background="#85929B"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
Full Code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e7ebee"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="452dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
BACK BUTTON
DIVIDER
<ImageView
android:id="@+id/windowtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#0a2436"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="10dip"
android:paddingTop="10dip"
android:src="@drawable/logo" >
</ImageView>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="@android:color/darker_gray"
android:dividerHeight="1dip"
android:drawSelectorOnTop="false"
android:focusable="false"
android:paddingTop="0dip" />
<!-- android:divider="@color/listDivider" -->
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="bottom"
>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#092435"
android:gravity="center_horizontal" >
<Button
android:id="@+id/btnManualLookup"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#4982AE"
android:gravity="center"
android:padding="15dip"
android:text="Activity"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:background="#85929B" />
<Button
android:id="@+id/supportbutton"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Support"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:background="#85929B" />
<Button
android:id="@+id/messagebutton"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Messages"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
put this code for divider
Horizontal line
<View
android:id="@+id/view"
android:background="#FF4500"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_below="@+id/listview_id" />
vertical line
<View
android:id="@+id/view"
android:background="#FF4500"
android:layout_width="2dp"
android:layout_height="fill_parent" />
YOUR xml change like this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e7ebee"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher" />
<ImageView
android:id="@+id/backdivider"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_toRightOf="@+id/back"
android:background="#85929B"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="452dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/windowtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#0a2436"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="10dip"
android:paddingTop="10dip" >
</ImageView>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="@android:color/darker_gray"
android:dividerHeight="1dip"
android:drawSelectorOnTop="false"
android:focusable="false"
android:paddingTop="0dip" />
<!-- android:divider="@color/listDivider" -->
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="bottom" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#092435"
android:gravity="center_horizontal" >
<Button
android:id="@+id/btnManualLookup"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#4982AE"
android:gravity="center"
android:padding="15dip"
android:text="Activity"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="6dip"
android:layout_marginTop="6dip"
android:background="#85929B" />
<Button
android:id="@+id/supportbutton"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Support"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="6dip"
android:layout_marginTop="6dip"
android:background="#85929B" />
<Button
android:id="@+id/messagebutton"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Messages"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>