Date picker popping wherever i click on screen - android

DATE PICKER POPPING wherever i click on the screen!!
search_page.xml
<?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:background="#E1E1E1"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<TableRow
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<RelativeLayout
android:id="#+id/TopNavigationBarRestaurantDesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#726E6D" >
<!-- Back Button -->
<Button
android:id="#+id/TopNavigationBarRestaurantSearchActivityBackButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/black_button"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="BACK"
android:textColor="#android:color/white"
android:textSize="12sp" />
<!-- Restaurant Description page name -->
<TextView
android:id="#+id/TopNavigationBarRestaurantSearchActivityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Search"
android:textColor="#android:color/white"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"
android:textSize=" 15dp"
android:textStyle="bold" />
<EditText
android:id="#+id/CITY_ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:textSize=" 15dp"
android:textStyle="bold" />
<EditText
android:id="#+id/DATE_EDIT_TEXT_ID"
android:layout_width="256dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext"
android:onClick="selectDate" >
<requestFocus />
</EditText>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="2.5" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Type"
android:textSize=" 15dp"
android:textStyle="bold" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/BreakfastRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:checked="true"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Breakfast" />
<RadioButton
android:id="#+id/LunchRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Lunch" />
<RadioButton
android:id="#+id/DinnerRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Dinner" />
</RadioGroup>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="172dp"
android:background="#E1E1E1"
android:onClick="selectDate"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<Button
android:id="#+id/SEARCH_BUTTON_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="38dp"
android:background="#drawable/blue_button"
android:text="Search" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#E1E1E1"
android:orientation="horizontal" >
<include
android:layout_alignParentTop="true"
layout="#layout/screen_bottombar_photodesc" />
</RelativeLayout>
</LinearLayout>
How to resolve this !

You have onClick event in the RelativeLayout
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="172dp"
android:background="#E1E1E1"
android:onClick="selectDate"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
Corrected layout
<?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:background="#E1E1E1"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<TableRow
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<RelativeLayout
android:id="#+id/TopNavigationBarRestaurantDesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#726E6D" >
<!-- Back Button -->
<Button
android:id="#+id/TopNavigationBarRestaurantSearchActivityBackButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/black_button"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="BACK"
android:textColor="#android:color/white"
android:textSize="12sp" />
<!-- Restaurant Description page name -->
<TextView
android:id="#+id/TopNavigationBarRestaurantSearchActivityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Search"
android:textColor="#android:color/white"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"
android:textSize=" 15dp"
android:textStyle="bold" />
<EditText
android:id="#+id/CITY_ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:textSize=" 15dp"
android:textStyle="bold" />
<EditText
android:id="#+id/DATE_EDIT_TEXT_ID"
android:layout_width="256dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext"
android:onClick="selectDate" >
<requestFocus />
</EditText>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="2.5" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Type"
android:textSize=" 15dp"
android:textStyle="bold" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/BreakfastRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:checked="true"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Breakfast" />
<RadioButton
android:id="#+id/LunchRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Lunch" />
<RadioButton
android:id="#+id/DinnerRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Dinner" />
</RadioGroup>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="172dp"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<Button
android:id="#+id/SEARCH_BUTTON_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="38dp"
android:background="#drawable/blue_button"
android:text="Search" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#E1E1E1"
android:orientation="horizontal" >
<include
android:layout_alignParentTop="true"
layout="#layout/screen_bottombar_photodesc" />
</RelativeLayout>
</LinearLayout>

Both your text view DATE_EDIT_TEXT_ID and your (lower) RelativeLayout have android:onClick="selectDate" which will open your date picker when either is clicked. I don't know how much of the screen either takes up (im a bad human xml parser) but I have a feeling that is part of your problem here. (I cant directly test it as I dont have eclipse around right now)

This is because you have declared android:onClick="selectDate" in both date editText and RelativeLayout.
Remove it form RelativeLayout
Paste the following code in your search_page.xml
<?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:background="#E1E1E1"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<TableRow
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<RelativeLayout
android:id="#+id/TopNavigationBarRestaurantDesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#726E6D" >
<!-- Back Button -->
<Button
android:id="#+id/TopNavigationBarRestaurantSearchActivityBackButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/black_button"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="BACK"
android:textColor="#android:color/white"
android:textSize="12sp" />
<!-- Restaurant Description page name -->
<TextView
android:id="#+id/TopNavigationBarRestaurantSearchActivityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Search"
android:textColor="#android:color/white"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"
android:textSize=" 15dp"
android:textStyle="bold" />
<EditText
android:id="#+id/CITY_ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:textSize=" 15dp"
android:textStyle="bold" />
<EditText
android:id="#+id/DATE_EDIT_TEXT_ID"
android:layout_width="256dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/rounded_edittext"
android:onClick="selectDate" >
<requestFocus />
</EditText>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="2.5" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Type"
android:textSize=" 15dp"
android:textStyle="bold" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/BreakfastRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:checked="true"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Breakfast" />
<RadioButton
android:id="#+id/LunchRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Lunch" />
<RadioButton
android:id="#+id/DinnerRG_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight=".5"
android:background="#drawable/yourbuttonbackground"
android:button="#android:color/transparent"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Dinner" />
</RadioGroup>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="172dp"
android:background="#E1E1E1"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<Button
android:id="#+id/SEARCH_BUTTON_ID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="38dp"
android:background="#drawable/blue_button"
android:text="Search" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#E1E1E1"
android:orientation="horizontal" >
<include
android:layout_alignParentTop="true"
layout="#layout/screen_bottombar_photodesc" />
</RelativeLayout>
</LinearLayout>
This should work

I'm not completely sure, but i think your problem is <requestFocus />, try to remove it and see what is happen.

Related

SlidingDrawer And ScrollView

I have a SlidingDrawer. And I want use ScrollView in my SlidingDrawer. I Try but app is not running.
I am tried ScrollView in LinearLayout but still not running app.
How can I do this.
Here İs Code:
.
.
.
.
.
.
<LinearLayout
android:id="#+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<SlidingDrawer
android:layout_width="wrap_content"
android:layout_height="330dp"
android:content="#+id/content"
android:handle="#+id/handle"
android:id="#+id/slidingDrawer"
android:layout_gravity="center_horizontal"
android:padding="10dip">
<Button
android:id="#+id/handle"
android:layout_width="200dp"
android:layout_height="33dp"
android:text="== ÇÖZÜM =="
android:textSize="10dp"/>
<!-- I Try Add LinearLayout here But still not ronning.-->
<ScrollView
android:id="#+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#ababab"
android:gravity="center|top"
android:padding="10dip">
.
.
.
.
.
.
</ScrollView>
</SlidingDrawer>
</LinearLayout>
THANKS!
This is my layout design that i had used in one of my project and it worked perfect check this :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.wholesaleraja.touch_image.TouchImageZoom
android:id="#+id/singe_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:src="#drawable/raja" />
<RelativeLayout
android:id="#+id/det"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/single_item_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="5dp"
android:text="Single Name"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<View
android:id="#+id/view"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/single_item_text"
android:background="#color/list_divider" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/view"
android:orientation="horizontal" >
<TextView
android:id="#+id/code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Product Code : "
android:textColor="#000000"
android:textSize="17sp"
android:textStyle="bold" />
<TextView
android:id="#+id/code_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="#+id/price_tag"
style="#style/button_text"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:background="#drawable/price_button_background"
android:clickable="false"
android:padding="5dp"
android:text="Price"
android:textColor="#ffffff" />
</RelativeLayout>
<SlidingDrawer
android:id="#+id/SlidingDrawer"
android:layout_width="fill_parent"
android:layout_height="400dp"
android:layout_alignParentBottom="true"
android:content="#+id/contentLayout"
android:handle="#+id/slideButton"
android:orientation="vertical"
android:padding="0dip"
android:rotation="0" >
<ImageView
android:id="#+id/slideButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/up" />
<ScrollView
android:id="#+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e5e5e5" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="7dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lot Size : "
android:textSize="15sp" />
<TextView
android:id="#+id/lot_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1 "
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Piece(s)/Lot"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp" >
<TableLayout
android:id="#+id/details"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:orientation="vertical"
android:stretchColumns="*" >
<TableRow
android:id="#+id/row3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Lot(s) "
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Discount"
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Price/Lot"
android:textSize="22sp" />
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Lot Qty : "
android:textSize="18sp" />
<Button
android:id="#+id/minus"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:background="#drawable/round_button"
android:text="-"
android:textSize="30sp"
android:textStyle="bold" />
<EditText
android:id="#+id/count"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/round_edittext"
android:focusable="false"
android:gravity="center"
android:inputType="number" >
</EditText>
<Button
android:id="#+id/plus"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#drawable/round_button"
android:text="+"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="#+id/addtocart"
style="#style/button_text"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:background="#drawable/cart_button_background"
android:padding="5dp"
android:text="Add to Cart"
android:textColor="#ffffff" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
<TextView
android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="7dp"
android:text="Description"
android:textSize="20sp"
android:textStyle="bold" />
<View
android:layout_width="fill_parent"
android:layout_height="1.5dp"
android:background="#color/list_divider" />
<TextView
android:id="#+id/full_desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:padding="5dp"
android:paddingBottom="5dp"
android:textSize="15sp" />
</LinearLayout>
</ScrollView>
</SlidingDrawer>
</RelativeLayout>
</FrameLayout>

How to keep the listview and mapview inside scrollview?

First of all, I know it's not good to keep the mapview or listview inside the scrollview. But i wish to design the page like the following.
I tried setListViewHeightBasedOnchildren method. It is sluggish as my listview is dynamic. The mapview, I can't scroll up and down and it's flickering when i am scrolling.
What is the best way to do this?
Can i add all the view as my listview header? The mapview is heavy!! Can i add that view as header to the listview?
Here is the source code :
<?xml version="1.0" encoding="utf-8"?>
<include
android:id="#+id/bottomMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
layout="#layout/bottom_menu" />
<include
android:id="#+id/topMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
layout="#layout/top_menu" />
<ScrollView
android:id="#+id/mainScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#id/bottomMenu"
android:layout_below="#id/topMenu"
android:fadingEdge="vertical"
android:fadingEdgeLength="20dip"
android:fillViewport="true"
android:scrollbars="none" >
<TableLayout
android:id="#+id/linearShopInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Images and its header -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dip" >
<ImageView
android:id="#+id/imgStoreImage"
android:layout_width="150dip"
android:layout_height="165dip"
android:adjustViewBounds="true"
android:background="#drawable/rounded_white_border"
android:contentDescription="#string/app_name"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center"
android:orientation="vertical" >
<!-- style="#style/CustomRatingBar" -->
<RatingBar
android:id="#+id/ratingShops"
style="#style/CustomRatingBar"
android:layout_width="wrap_content"
android:layout_height="25dip"
android:layout_margin="5dip"
android:clickable="false"
android:focusable="false"
android:isIndicator="true"
android:numStars="5"
android:stepSize="0.5" />
<TextView
android:id="#+id/txtReviewCount"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:singleLine="true"
android:textColor="#color/black" />
<CheckBox
android:id="#+id/chkFavoriteShop"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:button="#drawable/icon_star_empty"
android:drawablePadding="5dip"
android:text="#string/favorite_store" />
<TextView
android:id="#+id/txtConnect"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:singleLine="true"
android:text="#string/share"
android:textColor="#color/black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:orientation="horizontal" >
<ImageView
android:id="#+id/btnFaceBook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:contentDescription="#string/app_name"
android:padding="3dip"
android:src="#drawable/icon_facebook" />
<ImageView
android:id="#+id/btnTwitter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:contentDescription="#string/app_name"
android:padding="3dip"
android:src="#drawable/icon_twitter" />
<ImageView
android:id="#+id/btnGooglePlus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:contentDescription="#string/app_name"
android:padding="3dip"
android:src="#drawable/icon_google_plus" />
<ImageView
android:id="#+id/btnShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:contentDescription="#string/app_name"
android:padding="3dip"
android:src="#drawable/icon_share" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:layout_marginTop="2dip"
android:background="#drawable/line" />
<TextView
android:id="#+id/txtAboutStoreCaption"
style="#android:style/TextAppearance.Large"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:singleLine="true"
android:text="#string/about_the_store"
android:textColor="#color/black" />
<TextView
android:id="#+id/txtAboutStore"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:textColor="#color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:layout_marginTop="2dip"
android:background="#drawable/line" />
<TextView
android:id="#+id/txtMapAndLocationCaption"
style="#android:style/TextAppearance.Large"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:singleLine="true"
android:text="#string/map_and_location"
android:textColor="#color/black" />
<FrameLayout
android:id="#+id/mMapFrame"
android:layout_width="fill_parent"
android:layout_height="230dip" >
<android.support.v4.view.ViewPager
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
<fragment
android:id="#+id/mMapView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.SupportMapFragment"
android:background="#android:color/transparent" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent" />
</FrameLayout>
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:layout_marginTop="2dip"
android:background="#drawable/line" />
<TextView
android:id="#+id/txtShopAddress"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="8dip"
android:singleLine="true"
android:text="#string/coupons"
android:textColor="#color/black" />
<View
android:layout_width="fill_parent"
android:layout_height="3dip"
android:layout_marginTop="2dip"
android:background="#drawable/line" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:orientation="horizontal"
android:padding="3dip" >
<TextView
android:id="#+id/txtShopWebAddress"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="#drawable/icon_mouse"
android:drawablePadding="4dip"
android:gravity="center"
android:padding="5dip"
android:paddingLeft="25dip"
android:singleLine="true"
android:text="#string/view_website"
android:textColor="#color/blue" />
<View
android:layout_width="2dip"
android:layout_height="30dip"
android:layout_marginTop="2dip"
android:background="#color/blue" />
<TextView
android:id="#+id/txtShopNumber"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="#drawable/icon_phone"
android:drawablePadding="4dip"
android:gravity="center"
android:padding="5dip"
android:paddingLeft="25dip"
android:singleLine="true"
android:textColor="#color/blue" />
</LinearLayout>
<LinearLayout
android:id="#+id/linOffers"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/txtRewards"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/dark_grey"
android:gravity="center"
android:paddingBottom="12dip"
android:paddingTop="12dip"
android:text="#string/rewards"
android:textColor="#color/white" />
<View
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="#color/black" />
<TextView
android:id="#+id/txtDeals"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/dark_grey"
android:gravity="center"
android:paddingBottom="12dip"
android:paddingTop="12dip"
android:text="#string/deals"
android:textColor="#color/white" />
<View
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="#color/black" />
<TextView
android:id="#+id/txtCoupons"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/dark_grey"
android:gravity="center"
android:paddingBottom="12dip"
android:paddingTop="12dip"
android:singleLine="true"
android:text="#string/coupons"
android:textColor="#color/white" />
<View
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="#color/black" />
<TextView
android:id="#+id/txtGiftCards"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/grey_deep_dark"
android:gravity="center"
android:paddingBottom="12dip"
android:paddingTop="12dip"
android:singleLine="true"
android:text="#string/gift_cards"
android:textColor="#color/black" />
</LinearLayout>
<TextView
android:id="#+id/txtRewardBalance"
style="#android:style/TextAppearance.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:gravity="center"
android:padding="5dip"
android:singleLine="true"
android:textColor="#color/black" />
<ListView
android:id="#+id/offerList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="30dip"
android:fadingEdge="vertical"
android:fadingEdgeLength="20dip"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:scrollbarStyle="outsideOverlay" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/linGiftCards"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/txtGiftCardBalance"
style="#android:style/TextAppearance.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:gravity="center"
android:padding="5dip"
android:singleLine="true"
android:textColor="#color/black" />
<TextView
android:id="#+id/txtAddToCard"
style="#android:style/TextAppearance.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:background="#drawable/btn_blue_full_size"
android:gravity="center"
android:padding="5dip"
android:text="#string/add_to_card"
android:textColor="#color/white" />
<TextView
android:id="#+id/txtGiveAGiftCard"
style="#android:style/TextAppearance.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dip"
android:layout_marginTop="10dip"
android:background="#drawable/btn_blue_full_size"
android:drawableLeft="#drawable/ic_gift_card"
android:drawablePadding="6dip"
android:gravity="center"
android:paddingLeft="30dip"
android:paddingRight="30dip"
android:text="#string/give_a_gift_card"
android:textColor="#color/white" />
</LinearLayout>
<TextView
android:id="#+id/txtNoOffersAvail"
style="#android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="150dip"
android:gravity="center"
android:textColor="#color/black" />
</TableLayout>
</ScrollView>

The following classes could not be instantiated: - com.google.ads.AdView Admob

I'm new to Admob sdk and I'm adding Admob on an app I'm developing but I'm getting error on the xml.
This is my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#0b2f50"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="#+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="SAMPLE"
ads:loadAdOnCreate="true" />
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="#081f34" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp"
android:gravity="center"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:inputType="textNoSuggestions"
android:src="#drawable/logo2" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#8998a5" />
<ImageView
android:id="#+id/ImgVdetails"
android:layout_width="45dp"
android:layout_height="45dp"
android:background="#layout/btn_save"
android:padding="10dp"
android:src="#drawable/info" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#8998a5" />
<ImageView
android:id="#+id/refresh"
android:layout_width="45dp"
android:layout_height="45dp"
android:background="#layout/btn_save"
android:padding="10dp"
android:src="#drawable/refresh" />
<ProgressBar
android:id="#+id/refreshBar"
android:layout_width="45dp"
android:layout_height="45dp"
android:padding="10dp"
android:visibility="gone" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#8998a5" />
<ImageView
android:id="#+id/imageButton1"
android:layout_width="55dp"
android:layout_height="45dp"
android:background="#layout/btn_save"
android:contentDescription="#string/btnSettings"
android:padding="10dp"
android:src="#drawable/settings" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#8998a5" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#c9d2da" >
<LinearLayout
android:id="#+id/wrap1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Today is "
android:textSize="14dp" />
<TextView
android:id="#+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="14dp" />
</LinearLayout>
<View
android:id="#+id/v1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/wrap1"
android:background="#0b2f50" />
<LinearLayout
android:id="#+id/wrap2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/v1"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Destination: "
android:textSize="20dp" />
<TextView
android:id="#+id/t2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text=""
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp" >
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Distance: "
android:textSize="20dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/t3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/v2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/wrap2"
android:background="#0b2f50" />
<TextView
android:id="#+id/title1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/v2"
android:padding="5dp"
android:text="ALARM SETTINGS"
android:textSize="14dp" />
<LinearLayout
android:id="#+id/wrap3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/title1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<LinearLayout
android:layout_width="140dp"
android:layout_height="wrap_content" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Mode: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="In-Range"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Sound: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text=""
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<LinearLayout
android:layout_width="140dp"
android:layout_height="wrap_content" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Range: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Vibrate: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/v3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/wrap3"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#0b2f50" />
<TextView
android:id="#+id/title2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/v3"
android:paddingLeft="5dp"
android:text="STATUS"
android:textSize="14dp" />
<TextView
android:id="#+id/t8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/title2"
android:paddingLeft="15dp"
android:text=""
android:textSize="15dp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#0a1d2e" />
<ToggleButton
android:id="#+id/TglBtn_setAlarm"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:layout_weight="1.0"
android:background="#layout/btn_style"
android:textColor="#fff"
android:textOff="#string/TglBtn_setAlarmOn"
android:textOn="#string/TglBtn_setAlarmOff"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
I add the adView on the top but I'm getting error.
Here is the error:
The following classes could not be instantiated:
- com.google.ads.AdView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
java.lang.NoSuchMethodError: com.google.ads.AdSize.createAdSize(Lcom/google/ads/AdSize;Landroid/content/Context;)Lcom/google/ads/AdSize;
at com.google.ads.AdView.a(SourceFile:161)
at com.google.ads.AdView.a(SourceFile:273)
at com.google.ads.AdView.a(SourceFile:394)
at com.google.ads.AdView.<init>(SourceFile:125)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:-2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
Can someone help me to fix this. Thank you.
Have you added the AdActivity to your manifest?
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
See:
com.google.ads.AdView failed to instantiate
com.google.ads.AdView failed to instantiate layout issue
Also try changing the ads namespace from:
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
to:
xmlns:ads="http://schemas.android.com/apk/res-auto"
If you are using the latest version of Google AdMobSKD, then make sure you update the namespaces to:
com.google.android.gms.ads.AdView
did you try like this, you are putting your ad unit id in right?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#0b2f50"
>
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="#081f34" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp"
android:gravity="center"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:inputType="textNoSuggestions"
android:src="#drawable/logo2" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#8998a5" />
<ImageView
android:id="#+id/ImgVdetails"
android:layout_width="45dp"
android:layout_height="45dp"
android:background="#layout/btn_save"
android:padding="10dp"
android:src="#drawable/info" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#8998a5" />
<ImageView
android:id="#+id/refresh"
android:layout_width="45dp"
android:layout_height="45dp"
android:background="#layout/btn_save"
android:padding="10dp"
android:src="#drawable/refresh" />
<ProgressBar
android:id="#+id/refreshBar"
android:layout_width="45dp"
android:layout_height="45dp"
android:padding="10dp"
android:visibility="gone" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#8998a5" />
<ImageView
android:id="#+id/imageButton1"
android:layout_width="55dp"
android:layout_height="45dp"
android:background="#layout/btn_save"
android:contentDescription="#string/btnSettings"
android:padding="10dp"
android:src="#drawable/settings" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#8998a5" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#c9d2da" >
<LinearLayout
android:id="#+id/wrap1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Today is "
android:textSize="14dp" />
<TextView
android:id="#+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="14dp" />
</LinearLayout>
<View
android:id="#+id/v1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/wrap1"
android:background="#0b2f50" />
<LinearLayout
android:id="#+id/wrap2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/v1"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Destination: "
android:textSize="20dp" />
<TextView
android:id="#+id/t2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text=""
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp" >
<TextView
android:layout_width="130dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Distance: "
android:textSize="20dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/t3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/v2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/wrap2"
android:background="#0b2f50" />
<TextView
android:id="#+id/title1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/v2"
android:padding="5dp"
android:text="ALARM SETTINGS"
android:textSize="14dp" />
<LinearLayout
android:id="#+id/wrap3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/title1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<LinearLayout
android:layout_width="140dp"
android:layout_height="wrap_content" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Mode: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="In-Range"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Sound: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text=""
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<LinearLayout
android:layout_width="140dp"
android:layout_height="wrap_content" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Range: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Vibrate: "
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/t7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/v3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/wrap3"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#0b2f50" />
<TextView
android:id="#+id/title2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/v3"
android:paddingLeft="5dp"
android:text="STATUS"
android:textSize="14dp" />
<TextView
android:id="#+id/t8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/title2"
android:paddingLeft="15dp"
android:text=""
android:textSize="15dp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#0a1d2e" />
<ToggleButton
android:id="#+id/TglBtn_setAlarm"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:layout_weight="1.0"
android:background="#layout/btn_style"
android:textColor="#fff"
android:textOff="#string/TglBtn_setAlarmOn"
android:textOn="#string/TglBtn_setAlarmOff"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<com.google.ads.AdView
android:id="#+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adUnitId="SAMPLE"
ads:loadAdOnCreate="true" > </com.google.ads.AdView>
</RelativeLayout>

Android Layout alignment issues

I have a layout which i need to make it look alike Image B. But it comes like Image A. Am i messing too much with Linear or Relative Layouts ? Also i have footbar buttons inside Table Layout which works fine in all other screens but for this it doesn't shows up. Below is my code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical"
android:padding="8dip" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#f2f2f2"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:layout_marginLeft="0dip"
android:src="#drawable/back" />
<TextView
android:id="#+id/inboxtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal|center_vertical"
android:background="#f2f2f2"
android:textColor="#444444"
android:text="New message"
android:textSize="18sp" >
</TextView>
<ImageView
android:id="#+id/deleteheader"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toLeftOf="#+id/delete"
android:background="#ffffff"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
<ImageButton
android:id="#+id/emailsender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/sendicon"
android:text="Sync" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#f2f2f2"
android:gravity="center"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#444444"
android:orientation="vertical" >
<TextView
android:id="#+id/dropdown_textview"
android:layout_width="fill_parent"
android:layout_height="43dp"
android:layout_gravity="top"
android:background="#drawable/dropdown_background"
android:gravity="center_vertical|left"
android:hint="Select Subject"
android:paddingLeft="15dp"
android:textColor="#4a82ae"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_gravity="top"
android:layout_marginTop="44dp"
android:orientation="vertical" >
<EditText
android:id="#+id/mailcontent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#color/white"
android:gravity="left"
android:hint="Enter Content Here"
android:paddingLeft="15dp"
android:textColorLink="#color/white" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:id="#+id/dropdown_foldout_menu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dropdown_textview"
android:layout_gravity="top"
android:layout_marginTop="42dp"
android:background="#drawable/dropdown_background"
android:orientation="vertical"
android:padding="1dip"
android:visibility="gone" >
<TextView
android:id="#+id/dropdown_alt0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 1"
android:textSize="17dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#cccccc" />
<TextView
android:id="#+id/dropdown_alt1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 2"
android:textSize="17dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#cccccc" />
<TextView
android:id="#+id/dropdown_alt2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 3"
android:textSize="17dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#cccccc" />
<TextView
android:id="#+id/dropdown_alt3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 4"
android:textSize="17dp" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="bottom"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<Button
android:id="#+id/home"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Activity"
android:textColor="#ffffff" />
<Button
android:id="#+id/status"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Support"
android:textColor="#ffffff" />
<Button
android:id="#+id/support"
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>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical"
android:padding="8dip" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f2f2f2"
android:orientation="horizontal" >
<ImageView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dip"
android:src="#drawable/back" />
<ImageView
android:id="#+id/deleteheader"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:background="#ffffff"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
<TextView
android:id="#+id/inboxtext"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:background="#f2f2f2"
android:textColor="#444444"
android:text="New message"
android:textSize="18sp" >
</TextView>
<ImageView
android:id="#+id/deleteheader"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:background="#ffffff"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
<ImageButton
android:id="#+id/emailsender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/sendicon"
android:text="Sync" />
</LinearLayout>
<TextView
android:id="#+id/dropdown_textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#drawable/dropdown_background"
android:gravity="center_vertical|left"
android:hint="Select Subject"
android:padding="10dp"
android:textColor="#4a82ae"
android:textSize="15sp" />
<EditText
android:id="#+id/mailcontent"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:background="#ffffff"
android:gravity="left"
android:hint="Enter Content Here"
android:paddingLeft="15dp"
android:textColorLink="#ffffff" >
<requestFocus />
</EditText>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="bottom"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<Button
android:id="#+id/home"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:text="Activity"
android:textColor="#ffffff" />
<Button
android:id="#+id/status"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:text="Support"
android:textColor="#ffffff" />
<Button
android:id="#+id/support"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:text="Messages"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
Try with code and for Selecting message You can use pop up.
If you want do by your method then try with this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical"
android:padding="8dip" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f2f2f2"
android:orientation="horizontal" >
<ImageView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:src="#drawable/back" />
<ImageView
android:id="#+id/deleteheader"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:background="#ffffff"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
<TextView
android:id="#+id/inboxtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#f2f2f2"
android:gravity="center"
android:text="New message"
android:textColor="#444444"
android:textSize="18sp" >
</TextView>
<ImageView
android:id="#+id/deleteheader"
android:layout_width="2dip"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:background="#ffffff"
android:paddingBottom="15dip"
android:paddingTop="15dip" />
<ImageButton
android:id="#+id/emailsender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/sendicon"
android:text="Sync" />
</LinearLayout>
<TextView
android:id="#+id/dropdown_textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#drawable/dropdown_background"
android:gravity="center_vertical|left"
android:hint="Select Subject"
android:padding="10dp"
android:textColor="#4a82ae"
android:textSize="15sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#f2f2f2" >
<EditText
android:id="#+id/mailcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:gravity="left"
android:hint="Enter Content Here"
android:paddingLeft="15dp"
android:textColorLink="#ffffff" >
<requestFocus />
</EditText>
<LinearLayout
android:id="#+id/dropdown_foldout_menu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/dropdown_background"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone" >
<TextView
android:id="#+id/dropdown_alt0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 1"
android:textSize="17dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#cccccc" />
<TextView
android:id="#+id/dropdown_alt1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 2"
android:textSize="17dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#cccccc" />
<TextView
android:id="#+id/dropdown_alt2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 3"
android:textSize="17dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#cccccc" />
<TextView
android:id="#+id/dropdown_alt3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/dropdown_selector"
android:gravity="center_vertical|left"
android:padding="10dip"
android:text="Subject 4"
android:textSize="17dp" />
</LinearLayout>
</RelativeLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="bottom"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<Button
android:id="#+id/home"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:text="Activity"
android:textColor="#ffffff" />
<Button
android:id="#+id/status"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:text="Support"
android:textColor="#ffffff" />
<Button
android:id="#+id/support"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:text="Messages"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
If your requirement is different or any thing else then comment.

Linear layout gets hidden on orientation change

I have the following layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<LinearLayout
android:id="#+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:orientation="vertical"
android:padding="3dp" >
<ImageView
android:id="#+id/list_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/member_80" />
<Button
android:id="#+id/setphoto"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:text="Set Photo"
android:textSize="10dp" />
</LinearLayout>
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/thumbnail"
android:layout_toRightOf="#+id/thumbnail"
android:text="Hermoine"
android:textColor="#040404"
android:textSize="16dp"
android:textStyle="bold"
android:typeface="sans" />
<TextView
android:id="#+id/artist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/title"
android:layout_marginTop="1dip"
android:layout_toRightOf="#+id/thumbnail"
android:text="Basic"
android:textColor="#343434"
android:textSize="14dp" />
<TextView
android:id="#+id/artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/artist"
android:layout_marginTop="40dp"
android:layout_toRightOf="#+id/thumbnail"
android:text="Joined on Sep,21 2013"
android:textColor="#343434"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/artist"
android:layout_toRightOf="#+id/thumbnail"
android:text="899 Posts" />
<TextView
android:id="#+id/membervotes"
android:layout_width="40dp"
android:layout_height="20dp"
android:layout_above="#+id/artist"
android:layout_marginLeft="14dp"
android:layout_toRightOf="#+id/artist"
android:background="#drawable/votes_bg"
android:gravity="center_horizontal"
android:text="388"
android:textColor="#343434"
android:textSize="10dip" />
<View
android:id="#+id/topformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/thumbnail"
android:layout_marginBottom="5dp"
android:layout_marginTop="6dp"
android:background="#android:color/darker_gray"
android:gravity="center" />
<LinearLayout
android:id="#+id/btnsettings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/topformline"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnFeaturedDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:drawableTop="#drawable/notification_icon" />
<View
android:layout_width="0.8dp"
android:layout_height="25dp"
android:layout_marginTop="8dp"
android:background="#android:color/darker_gray" />
<Button
android:id="#+id/btnFeaturedDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:drawableTop="#drawable/messages_icon" />
<View
android:layout_width="0.8dp"
android:layout_height="25dp"
android:layout_marginTop="8dp"
android:background="#android:color/darker_gray" />
<Button
android:id="#+id/btnprofile_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:drawableTop="#drawable/setting_icon" />
</LinearLayout>
<View
android:id="#+id/bottomformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/btnsettings"
android:layout_marginTop="-15dp"
android:background="#android:color/darker_gray"
android:gravity="center" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/bottomformline"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:padding="6dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="left"
android:orientation="vertical"
android:weightSum="3" >
<Button
android:id="#+id/main_btn_gingerbread"
style="#style/DashboardButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:drawableTop="#drawable/dialog_start_icon"
android:onClick="onButtonClicker"
android:text="Dialogs Started" />
<Button
android:id="#+id/main_btn_honeycomb"
style="#style/DashboardButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:drawableTop="#drawable/dialog_moderated_icon"
android:onClick="onButtonClicker"
android:text="Dialogs Moderated" />
<View
android:id="#+id/bottomformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/main_btn_honeycomb"
android:background="#android:color/darker_gray" />
<Button
android:id="#+id/main_btn_honeycomb"
style="#style/DashboardButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:drawableTop="#drawable/followers_icon"
android:onClick="onButtonClicker"
android:text="Followers" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:gravity="right"
android:orientation="vertical"
android:weightSum="3" >
<Button
android:id="#+id/main_btn_gingerbread"
style="#style/DashboardButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:drawableTop="#drawable/dialog_argued_icon"
android:onClick="onButtonClicker"
android:text="Dialogs Argued" />
<Button
android:id="#+id/main_btn_honeycomb"
style="#style/DashboardButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:drawableTop="#drawable/archive_icon"
android:onClick="onButtonClicker"
android:text="Dialogs Archived " />
<View
android:id="#+id/bottomformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/main_btn_honeycomb"
android:background="#android:color/darker_gray" />
<Button
android:id="#+id/main_btn_honeycomb"
style="#style/DashboardButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:drawableTop="#drawable/following_icon"
android:onClick="onButtonClicker"
android:text="Following" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
It is displaying properly in portrait mode but in landscape mode the below linearlayout is hidden(it is not displayed).
Any ideas pls?
Thanks,
Not sure, just guessing: May be your upper view is taking more space and lower view has no space left on screen to show. Try putting your complete view in ScrollView.

Categories

Resources