Im having trouble aligning my button and textbox at the bottom of the page. Also may relative layout messed up. How do I add a view with the current conversation. my Listview is not working. I want to attain a simple design like this
here is my code. Also the grey is overlaying my app and i can't see my listview
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
/>
<RelativeLayout
android:id="#+id/InnerRelativeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
android:background="#color/gray"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="5dp" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:inputType="textMultiLine"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical" />
<Button
android:id="#+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:text="#string/send"
android:textSize="15sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
but my output looks like this
Try this..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.7"
android:gravity="center"
android:inputType="textMultiLine"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical"/>
<Button
android:id="#+id/send"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.3"
android:gravity="center"
android:text="#string/send" />
</LinearLayout>
</RelativeLayout>
Or
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button android:id="#+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="#string/send" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:layout_toLeftOf="#+id/send"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
EDIT:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false" />
</LinearLayout>
<LinearLayout
android:id="#+id/InnerRelativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/gray" >
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.8"
android:gravity="center"
android:inputType="textMultiLine"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical" />
<Button
android:id="#+id/send"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:text="#string/send"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
you should put your EditText and Button inside a LinerLayout(horizontal)
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content" <!-- or give some dimension -->
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical"
/>
<Button android:id="#+id/send"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/send" />
</LinearLayout>
Try below code..
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:inputType="textMultiLine"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:layout_toLeftOf="#+id/send"
android:scrollbars="vertical" />
<Button
android:id="#+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="send" />
</RelativeLayout>
It is looking like this.
use this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button android:id="#+id/send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="#string/send" />
<EditText
android:id="#+id/editText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:layout_toLeftOf="#id/send"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
Add a LinearLayout inside your main relative layout, and add your EditText and Button inside that LinearLayout. Don't forgat to add property android:layout_weight="1" to your elements. like this:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="3"
android:maxLines="3"
android:minLines="1"
android:scrollbars="vertical"
android:layout_weight="1"/>
<Button
android:id="#+id/send"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/send" />
</LinearLayout>
Related
i have a bad problem. i need to use a scrollview into my app, but this on start open editext Keyboard.
If Keyboard is open, scrollview work, but if i close the keybord scroll not work.
How to resolve this ploblem?
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/taglio"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:text="+"
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="#+id/piutagliodonna"
android:textStyle="normal|bold"
android:layout_weight="1"
android:alpha="0.70"
/>
<EditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/editTexttagliodonna"
android:hint="0"
android:textAlignment="center"
android:layout_weight="1"/>
<Button
android:text="-"
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="#+id/menotagliodonna"
android:layout_weight="1"
android:textStyle="normal|bold"
android:alpha="0.70"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Try this, but change and add RelativeLayout to LinearLayout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="pl.com.qubuss.test.RegisterActivity">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/nameET"
android:layout_marginTop="20dp"
android:inputType="textPersonName"
android:hint="#string/nameTextHint"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:width="200dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/surnameET"
android:layout_below="#+id/nameET"
android:layout_alignLeft="#+id/nameET"
android:layout_alignStart="#+id/nameET"
android:layout_marginTop="20dp"
android:width="200dp"
android:hint="#string/surnameTextHint" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="#+id/emailET"
android:hint="#string/emailTextHint"
android:width="200dp"
android:layout_below="#+id/surnameET"
android:layout_alignLeft="#+id/surnameET"
android:layout_alignStart="#+id/surnameET"
android:layout_marginTop="20dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/username_registerET"
android:layout_below="#+id/emailET"
android:layout_alignLeft="#+id/emailET"
android:layout_alignStart="#+id/emailET"
android:layout_marginTop="20dp"
android:width="200dp"
android:hint="#string/usernameTextHint" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="#+id/password_registerET"
android:layout_below="#+id/username_registerET"
android:layout_alignLeft="#+id/username_registerET"
android:layout_alignStart="#+id/username_registerET"
android:layout_marginTop="20dp"
android:hint="#string/passwordTextHint" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/registerButton"
android:id="#+id/registerButton"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="23dp"
android:layout_below="#+id/conPasswor_registerET"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="#+id/conPasswor_registerET"
android:layout_marginTop="20dp"
android:layout_below="#+id/password_registerET"
android:layout_alignLeft="#+id/password_registerET"
android:layout_alignStart="#+id/password_registerET"
android:hint="#string/conPasswordTextHint" />
</RelativeLayout>
</ScrollView>
I'm a beginner in android. I'm creating a example phonebook using eclipse. i have few edit texts and a set off buttons in my layout.but when I run the project I can't see the buttons in the bottom of the layout, so I enclosed my main linear layout in a Scrollview. but after linear layout has become much bigger in height. i tried to resize it in the xml file but it is not working right after resizing the layout it automatically resizes in to the previous size. here's my code if anyone can help me.little help is highly appreciated.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="466dp"
android:layout_gravity="center_vertical" >
<LinearLayout
android:id="#+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/back"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical"
tools:context="com.nadusha.phonebook.MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contact Info"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/nameTextLayout"
android:orientation="horizontal"
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<EditText
android:id="#+id/nameTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" />
<requestFocus />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF"/>
</LinearLayout>
<LinearLayout
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/mobileNoTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/homeNoTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E-Mail "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/emailTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textEmailAddress" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/saveBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
android:textColor="#FFFFFF"/>
<Button
android:id="#+id/cancelBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:textColor="#FFFFFF" />
<Button
android:id="#+id/viewBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ViewContact"
android:textColor="#FFFFFF" />
</Linearlayout>
</LinearLayout>
You need to set ScrollView layoutWeight to 1 and its height to 0. This will ensure that your scrollview will take only remaining space on screen. Here is example of my app:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:id="#+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="false"
android:fadeScrollbars="false"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/menoLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="#string/emergencySMSMeno"/>
<EditText
android:id="#+id/menoEdit"
style="#style/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:textColor="#000"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="3">
<TextView
android:id="#+id/pohlavieLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="#string/emergencySMSPohlavie"/>
<Spinner
android:id="#+id/spinnerPohlavie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/vekLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="#string/emergencySMSVek"/>
<EditText
android:id="#+id/vekEdit"
style="#style/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="numberDecimal"
android:textColor="#000"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/vahaLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="#string/emergencySMSVaha"/>
<EditText
android:id="#+id/vahaEdit"
style="#style/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="numberDecimal"
android:textColor="#000"/>
</LinearLayout>
<TextView
android:id="#+id/alergieLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:text="#string/emergencySMSAlergie"/>
<EditText
android:id="#+id/alergieEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textColor="#000"/>
<TextView
android:id="#+id/chorobyLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:text="#string/emergencySMSChoroby"/>
<EditText
android:id="#+id/chorobyEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textColor="#000"/>
<TextView
android:id="#+id/zraneniaLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:text="#string/emergencySMSZranenie"/>
<EditText
android:id="#+id/zraneniaEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="3"
android:textColor="#000"/>
<TextView
android:id="#+id/polohaLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:text="#string/emergencySMSAktualnaPoloha"/>
<EditText
android:id="#+id/polohaEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textColor="#000"/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<Button
android:id="#+id/odoslatButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/send"
android:layout_weight="1"/>
<Button
android:id="#+id/zrusitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/emergencySMSZrusit"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
It shows scrollView and two buttons bellow it. I am not exactly sure what you want to do but as far as I can see you are doint it wrong. ScrollView can take only one child element but you have set scrollview as your main parent but then you put more child inside it.
Also you are doing another mistake. You dont need to use linear layouts (in most cases) if they have only one child. It is bad for performance.
Change the value of the attribute layout_height to match_parent so that the ScrollView take up the whole screen and hence enable scrolling. The correct code is
<ScrollView 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:layout_gravity="center_vertical" >
<LinearLayout
android:id="#+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/back"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical"
tools:context="com.nadusha.phonebook.MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contact Info"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/nameTextLayout"
android:orientation="horizontal"
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<EditText
android:id="#+id/nameTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" />
<requestFocus />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF"/>
</LinearLayout>
<LinearLayout
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/mobileNoTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/homeNoTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E-Mail "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_marginBottom="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/emailTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textEmailAddress" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/saveBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
android:textColor="#FFFFFF"/>
<Button
android:id="#+id/cancelBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:textColor="#FFFFFF" />
<Button
android:id="#+id/viewBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ViewContact"
android:textColor="#FFFFFF" />
</Linearlayout>
</LinearLayout>
You could try changing
android:layout_height="466dp"
to
android:layout_height="wrap_content"
or
android:layout_height="match_parent"
LinearLayout with editText on the bottom overlays the content of scrollView, which is filled programmatically.
How to avoid this please?
I have simplified the XML in vain in my first version of this message.
I have added the full code now
I'd like to keep my editText height expandable.
<?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="fill_parent"
android:background="#color/backNormal"
android:orientation="vertical"
>
<include layout="#layout/adview"
android:layout_alignParentTop="true"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal|center_vertical"
android:orientation="horizontal"
android:background="#color/back1"
android:layout_below="#+id/adView"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
>
<TextView
android:id="#+id/textChatSubjectTitle"
android:text='Subject'
android:gravity="left|center_vertical"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_weight="5"
android:layout_height="wrap_content"
android:textColor="#color/text1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="normal"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:orientation="horizontal"
>
<TextView
android:id="#+id/textChatActn"
android:text='0'
android:gravity="left|center_vertical"
android:layout_marginLeft="10dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/textWhite"
android:background="#color/gray"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<TextView
android:id="#+id/textChatUsers"
android:text='users'
android:gravity="left|center_vertical"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/darkGray"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="normal"
/>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageChatImageTitle"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="right"
/>
</LinearLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollChat"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/backNormal"
android:orientation="vertical"
android:layout_below="#+id/top"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
</LinearLayout>
</ScrollView>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/back1"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
>
<ImageView
android:id="#+id/buttonClip"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:src="#drawable/clip32"
android:layout_weight="1"
android:layout_gravity= "center_vertical|center_horizontal"
/>
<EditText
android:id="#+id/editChatMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textMultiLine|textCapSentences"
android:minLines="1"
android:gravity="top|left"
android:maxLines="5"
android:maxLength="500"
android:layout_marginRight="5dp"
android:text=''
android:layout_gravity= "center_vertical|center_horizontal"
android:textColor="#color/text1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="5"
android:background="#drawable/edit"
android:scrollHorizontally="false"
android:cursorVisible="true"
android:textCursorDrawable="#null"
/>
<Button
android:id="#+id/buttonChatSend"
android:text='>'
android:layout_marginRight="5dp"
android:gravity="center"
android:layout_gravity= "center_vertical|center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/darkGray"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:background="#drawable/button_normal"
/>
</LinearLayout>
</RelativeLayout>
Any ideas please?
Thanks!
I suggest using Relative layout for parent. And then add the rule above.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:id="#+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/llButton"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/llButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<EditText
android:id="#+id/editMessage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="top|left"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="5"
android:minLines="3"
android:scrollHorizontally="false" />
<Button
android:id="#+id/buttonSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text='send'
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Please try the below code, if it solves your problem.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linear"
android:layout_width="match_parent"
android:layout_height="1200dp"
android:background="#ff0000"
android:orientation="vertical"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/editMessage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="#drawable/edit"
android:gravity="top|left"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="5"
android:minLines="3"
android:textColor="#color/text1"
android:scrollHorizontally="false"
/>
<Button
android:id="#+id/buttonSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="#drawable/button_normal"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
</ScrollView>
I've an application where i place Radio Button & TextView on a same line . But When i run on Nexus 7 it looks like this :
I want to create to 2nd one .How can i solve this :
Here is my XML :
<?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:orientation="vertical"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#drawable/loginsigninbackground" >
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:orientation="vertical" >
<EditText
android:id="#+id/UserNameToLogin"
android:layout_width="300dp"
android:layout_height="40dp"
android:hint="#string/username"
android:ems="10"
android:layout_gravity="center"
android:background="#drawable/customised_edit_text"
android:singleLine="true"
android:gravity="center|left"
android:textColorHint="#30D683"
android:paddingLeft="20dp"
>
<requestFocus />
</EditText>
<EditText
android:id="#+id/UserPasswordToLogin"
android:layout_width="300dp"
android:layout_height="40dp"
android:hint="#string/password"
android:ems="10"
android:inputType="textPassword"
android:layout_gravity="center"
android:background="#drawable/customised_edit_text"
android:singleLine="true"
android:gravity="center|left"
android:textColorHint="#30D683"
android:layout_marginTop="5dp"
android:paddingLeft="20dp"
>
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radioButtonRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/remember_me"
android:checked="false"
android:textSize="18sp"
android:textColor="#30D683"
android:button="#drawable/radio_selector"
android:background="#android:color/transparent" />
<TextView
android:id="#+id/UserRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/forgot_password"
android:textColor="#30D683"
android:textSize="18sp"
android:cacheColorHint="#android:color/transparent"
android:background="#android:color/transparent"
/>
</LinearLayout>
<Button
android:id="#+id/ButtonNext"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="#string/next"
android:background="#drawable/customised_button_click"
android:onClick="gotosignup"
android:clickable="true"
android:textSize="20sp"
/>
<Button
android:id="#+id/ButtonSignUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/signup"
android:gravity="center"
android:textSize="20sp"
android:background="#drawable/customised_button_click"
android:onClick="gotosignup"
android:clickable="true"
/>
</LinearLayout>
</LinearLayout>
May I know what is the correct way to achieve my objective?Maybe this question too basic, but i did't find any suitable solution.Please Help me out.
Do not hardcode the height and width of your edit-text like you did
<EditText
android:id="#+id/UserPasswordToLogin"
android:layout_width="300dp"
android:layout_height="40dp"
android:hint="#string/password"
android:ems="10"
android:inputType="textPassword"
android:layout_gravity="center"
android:background="#drawable/customised_edit_text"
android:singleLine="true"
android:gravity="center|left"
android:textColorHint="#30D683"
android:layout_marginTop="5dp"
android:paddingLeft="20dp"
>
so basically it is
android:layout_width="300dp"
android:layout_height="40dp"
instead of give fill_parent or match_parent
android:layout_width="match_parent"
android:layout_height="match_parent"
or
android:layout_width="fill_parent"
android:layout_height="fill_parent"
do this for all text field and then try.
Try this..
There are two ways
1) Change EditText width as match_parent for both android:layout_width="match_parent"
<?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:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:orientation="vertical" >
<EditText
android:id="#+id/UserNameToLogin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:gravity="center|left"
android:hint="username"
android:paddingLeft="20dp"
android:singleLine="true"
android:textColorHint="#30D683" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/UserPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="center|left"
android:hint="password"
android:inputType="textPassword"
android:paddingLeft="20dp"
android:singleLine="true"
android:textColorHint="#30D683" >
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radioButtonRememberMe"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:checked="false"
android:text="remember_me"
android:textColor="#30D683"
android:textSize="18sp" />
<TextView
android:id="#+id/UserRememberMe"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cacheColorHint="#android:color/transparent"
android:text="forgot_password"
android:textColor="#30D683"
android:textSize="18sp" />
</LinearLayout>
<Button
android:id="#+id/ButtonNext"
android:layout_width="match_parent"
android:layout_height="60dp"
android:clickable="true"
android:onClick="gotosignup"
android:text="next"
android:textSize="20sp" />
<Button
android:id="#+id/ButtonSignUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:gravity="center"
android:onClick="gotosignup"
android:text="signup"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
and
2) change your LinearLayout width as 300dp and also remove android:layout_gravity="center" for both EditText
<LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radioButtonRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/remember_me"
android:checked="false"
android:textSize="18sp"
android:textColor="#30D683"
android:button="#drawable/radio_selector"
android:background="#android:color/transparent" />
<TextView
android:id="#+id/UserRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/forgot_password"
android:textColor="#30D683"
android:textSize="18sp"
android:cacheColorHint="#android:color/transparent"
android:background="#android:color/transparent"
/>
</LinearLayout>
change root linearlayout as
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
and set layout width as 300dp in childlayout
<LinearLayout
android:layout_width="300dp"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:orientation="vertical" >
I have been reading many posts here in stackoverflow about making a linear layout scroll and have applied all the specific advices to make it work but it still does not show on the left hand side. I am new to android and not sure what i am doing wrong.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView1">
<LinearLayout
android:id="#+id/expense"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="start"
android:orientation="vertical"
tools:context=".Expense" >
<LinearLayout
android:id="#+id/tedsts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/rounded"
android:clickable="true"
android:weightSum="1.0" >
<TextView
android:id="#+id/testffg"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".30"
android:text="Matter"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/tedssss"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".65"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:src="#drawable/r_arrow" />
</LinearLayout>
<TextView
android:id="#+id/tetxttx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="0dp"
android:layout_marginRight="10dp"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/gray_dark"
android:visibility="invisible" />
<EditText
android:id="#+id/teetttsss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_all"
android:ems="10"
android:gravity="top"
android:hint="dgdfgfgf"
android:inputType="textMultiLine" />
<LinearLayout
android:id="#+id/tesssstt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_all_clickable_selector"
android:clickable="true"
android:weightSum="1.0" >
<TextView
android:id="#+id/yttrree"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".20"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/rrrefffe"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".75"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:src="#drawable/r_arrow" />
</LinearLayout>
<RadioButton
android:id="#+id/dfgrrrrr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="5dp"
android:text="Cost"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/gergrerrr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:background="#drawable/rounded_all_clickable"
android:ems="10"
android:hint=""
android:inputType="numberDecimal"
android:singleLine="true" >
</EditText>
<RadioButton
android:id="#+id/rerreee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="5dp"
android:text="Time"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/gggrrrrre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/roundede"
android:ems="10"
android:hint="grrrergg."
android:inputType="numberDecimal"
android:singleLine="true"
android:visibility="gone" >
</EditText>
<EditText
android:id="#+id/65gfhhggf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:background="#drawable/rounded"
android:ems="10"
android:hint=""
android:inputType="numberDecimal" >
</EditText>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/gfhgfhtrhrth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
android:visibility="gone" />
<TextView
android:id="#+id/ghjjhhhgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/expense_TV_total"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="#+id/hgjhhghjhg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/save_selector" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
use this :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView ...>
<LinearLayout ...>
...
...
</LinearLayout>
</ScrollView>
and set hieght to
android:layout_height="wrap_content"
as Karakuri said
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
//Your Main Layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100">
// First Sub Layout Under Main Layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_weight="10"
android:weightSum="100" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="TextView"
android:layout_weight="70" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30" />
</LinearLayout>// Finishing First Sub layout
// Second Sub Layout Under Main Layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_weight="10"
android:weightSum="100" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="TextView"
android:layout_weight="70" />
<EditText
android:id="#+id/editText2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30" />
</LinearLayout>// Finishing Second Sub layout
similarly for 3rd,4rth,5th sub layouts and so on........
</LinearLayout> // Finishing Main Layout
</ScrollView> // Finishing ScrollView
Make the child of the ScrollView have android:layout_height="wrap_content" (currently yours has match_parent)
add
android:layout_width="match_parent"
android:layout_height="match_parent"
to your root ScrollView
I hope this code may be help you.
android:layout_width="match_parent"
android:layout_height="match_parent">