Linear layout gets hidden on orientation change - android

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.

Related

Not able to create responsive layout in android

I am creating a layout in android but I am not able to create a responsive layout. I have defined font size in pt but it distort on small screen. What should I do to make it responsive for all device. I have worst problem of font size. Screenshot on small screen is:
// My code
<?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:layout_margin="#dimen/activity_horizontal_margin"
android:background="#drawable/background_car_detail"
android:elevation="#dimen/activity_8_margin"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="2">
<FrameLayout
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="0dp"
android:layout_weight=".8"
android:background="#drawable/car">
<TextView
android:id="#+id/txtCertified"
style="#android:style/TextAppearance.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginTop="#dimen/activity_8_margin"
android:alpha="0.5"
android:background="#drawable/btn_right_curve"
android:backgroundTint="#color/colorBlack"
android:paddingBottom="2dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="2dp"
android:text="Certified"
android:textColor="#color/colorWhite" />
<TextView
android:id="#+id/status"
style="#android:style/TextAppearance.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/activity_8_margin"
android:background="#drawable/btn_background"
android:backgroundTint="#color/colorPrimary"
android:paddingBottom="2dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="2dp"
android:text="Sold"
android:textColor="#color/colorWhite" />
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_weight="1.2"
android:gravity="right"
android:orientation="vertical"
android:padding="#dimen/activity_horizontal_margin">
<TextView
android:id="#+id/carName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mahindra TUV300 T6 Plus"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/carKm"
style="#android:style/TextAppearance.DeviceDefault.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="29,6789 Km"
android:textSize="5pt" />
<View
android:layout_width="1dp"
android:layout_height="10dp"
android:layout_marginLeft="2pt"
android:layout_marginRight="2pt"
android:background="#000000" />
<TextView
android:id="#+id/carType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Disel"
android:textSize="5pt" />
<View
android:layout_width="1dp"
android:layout_height="10dp"
android:layout_marginLeft="2pt"
android:layout_marginRight="2pt"
android:background="#000000" />
<TextView
android:id="#+id/carYear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="5pt" />
</LinearLayout>
<TextView
android:id="#+id/carCondition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Condition: Excellent"
android:textSize="5pt" />
<TextView
android:id="#+id/carAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="Rs. 7.5L"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/carAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Singh car, Rajori Garden, Delhi"
android:textSize="5pt" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Check this out.
<?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:layout_margin="#dimen/activity_horizontal_margin"
android:background="#drawable/rounded_corner_bg"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="horizontal"
android:weightSum="2"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight=".8"
android:background="#drawable/com_facebook_button_like_background">
<TextView
android:id="#+id/txtCertified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_gravity="top|left"
android:layout_marginTop="20dp"
android:background="#drawable/red_button_background"
android:padding="5dp"
android:text="Certified"
android:textColor="#color/colorAccent"
android:textSize="12sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true">
<TextView
android:id="#+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/red_button_background"
android:gravity="end"
android:padding="5dp"
android:paddingBottom="2dp"
android:text="Sold"
android:textColor="#color/colorAccent" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.2"
android:gravity="right|center"
android:orientation="vertical">
<TextView
android:id="#+id/carName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mahindra TUV300 T6 Plus"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/carKm"
style="#android:style/TextAppearance.DeviceDefault.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="29,6789 Km"
android:textSize="5pt" />
<View
android:layout_width="1dp"
android:layout_height="10dp"
android:layout_marginLeft="2pt"
android:layout_marginRight="2pt"
android:background="#000000" />
<TextView
android:id="#+id/carType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Disel"
android:textSize="5pt" />
<View
android:layout_width="1dp"
android:layout_height="10dp"
android:layout_marginLeft="2pt"
android:layout_marginRight="2pt"
android:background="#000000" />
<TextView
android:id="#+id/carYear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="5pt" />
</LinearLayout>
<TextView
android:id="#+id/carCondition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Condition: Excellent"
android:textSize="5pt" />
<TextView
android:id="#+id/carAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="Rs. 7.5L"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/carAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Singh car, Rajori Garden, Delhi"
android:textSize="5pt" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Android text cut off in bottom of screen

Ok, after trying any solution I found I decided to put my code in here for help.
I get HTML from JSON and I place it in a TextView to show it.
This is it:
hoursTextView.setText(Html.fromHtml(hours));
hoursTextView.setVisibility(View.VISIBLE);
My problem is, that whenever the content above this TextView takes alot of height, I see only cutted top letters of this TextView and I can't scroll down!
This is my Layout XML:
<?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"
>
<ProgressBar
android:id="#+id/loadData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:layout_centerInParent="true"
/>
<ImageView
android:id="#+id/coverImg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_marginBottom="5dp"
/>
<TextView
android:id="#+id/fbAbout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/coverImg"
android:gravity="center"
/>
<View
android:id="#+id/seperator"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#eeeeee"
android:layout_below="#+id/fbAbout"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
/>
<LinearLayout
android:id="#+id/buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/seperator"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
>
<TextView
android:id="#+id/type"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/beer"
android:drawablePadding="5dp"
android:text="TYPE"
android:layout_weight="1"
/>
<TextView
android:id="#+id/age"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/age_big"
android:drawablePadding="5dp"
android:layout_marginStart="10dp"
android:text="AGE"
android:layout_weight="1"
/>
<Button
android:id="#+id/callToPlace"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/ic_call_black_24dp"
android:drawablePadding="5dp"
android:layout_marginStart="10dp"
android:text="CALL"
android:layout_weight="1"
/>
<Button
android:id="#+id/nav"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/navigate"
android:drawablePadding="5dp"
android:layout_marginStart="10dp"
android:text="navigate"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="HOURS"
android:id="#+id/hoursTitle"
android:layout_below="#+id/buttons"
android:layout_centerHorizontal="true"
android:visibility="gone"
android:layout_marginTop="10dp"
/>
<!--This is the TextView which is cut -->
<TextView
android:id="#+id/hours"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/hoursTitle"
android:visibility="gone"
android:layout_centerHorizontal="true"
android:gravity="center"
/>
</RelativeLayout>
The last TextView, with the ID of hours, is being cut on the bottom of the screen.
Hope someone can help me with this,
thanks!
You can use ScrollView for full screen.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/output">
<ProgressBar
android:id="#+id/loadData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:layout_centerInParent="true"
/>
<ImageView
android:id="#+id/coverImg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_marginBottom="5dp"
/>
<TextView
android:id="#+id/fbAbout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/coverImg"
android:gravity="center"
/>
<View
android:id="#+id/seperator"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#eeeeee"
android:layout_below="#+id/fbAbout"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
/>
<LinearLayout
android:id="#+id/buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/seperator"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
>
<TextView
android:id="#+id/type"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/beer"
android:drawablePadding="5dp"
android:text="TYPE"
android:layout_weight="1"
/>
<TextView
android:id="#+id/age"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/age_big"
android:drawablePadding="5dp"
android:layout_marginStart="10dp"
android:text="AGE"
android:layout_weight="1"
/>
<Button
android:id="#+id/callToPlace"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/ic_call_black_24dp"
android:drawablePadding="5dp"
android:layout_marginStart="10dp"
android:text="CALL"
android:layout_weight="1"
/>
<Button
android:id="#+id/nav"
android:layout_width="0dp"
android:layout_height="70dp"
android:background="#drawable/circle_text"
android:textAlignment="center"
android:gravity="center"
android:padding="10dp"
android:drawableTop="#drawable/navigate"
android:drawablePadding="5dp"
android:layout_marginStart="10dp"
android:text="navigate"
android:layout_weight="1"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="HOURS"
android:id="#+id/hoursTitle"
android:layout_below="#+id/buttons"
android:layout_centerHorizontal="true"
android:visibility="gone"
android:layout_marginTop="10dp"
/>
<!--This is the TextView which is cut -->
<TextView
android:id="#+id/hours"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/hoursTitle"
android:visibility="gone"
android:layout_centerHorizontal="true"
android:gravity="center"
/>
</ScrollView>
Another Example:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 1" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 2" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 3" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 4" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 5" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton 1" />
<RadioButton
android:id="#+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton 2" />
<ToggleButton
android:id="#+id/toggleButton1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ToggleButton" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 6" />
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="#+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 7" />
<Button
android:id="#+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 8" />
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CheckBox" />
<Button
android:id="#+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 9" />
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 10" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 11" />
</LinearLayout>
</ScrollView>
Add the scroll view
<ScrollView
android:layout_width="match_parent"
android:layout_height="150dp" >
<!--Just assume it whatever your height is-->
<TextView
android:id="#+id/hours"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_below="#+id/hoursTitle"
android:visibility="gone"
android:layout_centerHorizontal="true"
android:gravity="center"
/>
</ScrollView>

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>

Date picker popping wherever i click on screen

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.

ScrollView in nested layout in Android

I want to apply ScrollView to my entire screen. But scrollview can host only one direct child.
I have tried this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/dialogcreatemainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/votes_bg"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/dialogimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="3dp" >
<ImageView
android:id="#+id/dialog_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/dialog_image" />
<ImageView
android:id="#+id/profimage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/member_80" />
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/profimage"
android:text="By Hermoine - 2 days ago on Politics"
android:textColor="#040404"
android:textSize="12dp"
android:textStyle="normal"
android:typeface="sans" />
</LinearLayout>
<LinearLayout
android:id="#+id/pub_arc_rem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogimage"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnPublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Publish"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnArchive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Archive"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Remove"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pub_arc_rem"
android:layout_marginTop="10dp"
android:text="There Is Nothing Negative In Total Exploitation Of Natural Resources. What Say?"
android:textColor="#343434"
android:textSize="12dp" />
<TextView
android:id="#+id/dialog_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/dialog_title"
android:layout_marginTop="10dp"
android:text="I don&apos;t think you have to believe one or the other. I have personally met christian&apos;s who simply think the big bang is how god created the universe. I have also met atheist who believe that we don&apos;t have the ability to know how the universe began. I have."
android:textColor="#343434"
android:textSize="12dp" />
<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/dialog_det"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/list_image"
android:layout_toRightOf="#+id/list_image"
android:layout_weight="5"
android:padding="5dip"
android:text="Last Active: 6 days ago"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:src="#drawable/member" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dip"
android:text="8"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:src="#drawable/udebate_fav" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dp"
android:text="64"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/mod_friend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogcreatemainlayout"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnAssignModerator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Assign Moderator"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnInviteFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite Friends"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
</ScrollView>
Can anyone please guide me?
Thanks.
Wrap the content inside a Contanier. One from FrameLayour, LinearLayout, RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- your components -->
</LinearLayout>
</ScrollView>
Here is how its done:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/dialogcreatemainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/votes_bg"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/dialogimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="3dp" >
<ImageView
android:id="#+id/dialog_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/dialog_image" />
<ImageView
android:id="#+id/profimage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/member_80" />
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/profimage"
android:text="By Hermoine - 2 days ago on Politics"
android:textColor="#040404"
android:textSize="12dp"
android:textStyle="normal"
android:typeface="sans" />
</LinearLayout>
<LinearLayout
android:id="#+id/pub_arc_rem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogimage"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnPublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Publish"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnArchive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Archive"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Remove"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pub_arc_rem"
android:layout_marginTop="10dp"
android:text="There Is Nothing Negative In Total Exploitation Of Natural Resources. What Say?"
android:textColor="#343434"
android:textSize="12dp" />
<TextView
android:id="#+id/dialog_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/dialog_title"
android:layout_marginTop="10dp"
android:text="I don&apos;t think you have to believe one or the other. I have personally met christian&apos;s who simply think the big bang is how god created the universe. I have also met atheist who believe that we don&apos;t have the ability to know how the universe began. I have."
android:textColor="#343434"
android:textSize="12dp" />
<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/dialog_det"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/list_image"
android:layout_toRightOf="#+id/list_image"
android:layout_weight="5"
android:padding="5dip"
android:text="Last Active: 6 days ago"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:src="#drawable/member" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dip"
android:text="8"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:src="#drawable/udebate_fav" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dp"
android:text="64"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/mod_friend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogcreatemainlayout"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnAssignModerator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Assign Moderator"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnInviteFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite Friends"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
As you can see the ScrollView must have only one child.
just add vertical linearLyout after scrollview declaration and close the linearLayout before the scrolview tag is closed

Categories

Resources