I am trying to adjust the space between grid view and buttons
I have posted figure
I am trying to attain that
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- Top navigation bar for Restaurant Description Page -->
<TableRow
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="2sp" >
<RelativeLayout
android:id="#+id/TopNavigationBarRestaurantDesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#726E6D" >
<!-- Back Button -->
<Button
android:id="#+id/TopNavigationBarRestaurantDescActivityBackButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_shape"
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/TopNavigationBarRestaurantDescActivityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="TextView"
android:textColor="#android:color/white"
android:textSize="18sp"
android:textStyle="bold" />
<!-- Restaurant Description page Image -->
<ImageView
android:id="#+id/TopNavigationBarRestaurantDescActivityImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="2sp" >
<TextView
android:id="#+id/RestaurantTimingsID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Timings"
android:textStyle="bold" />
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp" >
</LinearLayout>
<TableRow
android:id="#+id/BuyReservedButtonRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2sp" >
<Button
android:id="#+id/BuyButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/buy_button_shape"
android:paddingBottom="13dp"
android:paddingLeft="16dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Buy"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6sp" />
<Button
android:id="#+id/ReservedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/reserverd_button_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Reserve"
android:textColor="#android:color/white" />
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableRow
android:id="#+id/DescriptionTitleRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="2sp" >
<GridView
android:id="#+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="80dp"
android:gravity="center"
android:numColumns="3"
android:scrollbars="horizontal"
android:stretchMode="spacingWidthUniform" >
</GridView>
</TableRow>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp" >
</LinearLayout>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal" >
<Button
android:id="#+id/RestaurantDescriptionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Description"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantLocationButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Location"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantPhotosButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Photos"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantFriendsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Friends"
android:textColor="#android:color/white"
android:textSize="11sp" />
</LinearLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal" >
<Button
android:id="#+id/RestaurantSearchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_square_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Search"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantFeaturedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_square_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Featured"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantDealsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_square_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Deals"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantInviteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_square_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Invite"
android:textColor="#android:color/white"
android:textSize="11sp" />
<Button
android:id="#+id/RestaurantAccountButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_square_shape"
android:paddingBottom="13dp"
android:paddingLeft="13dp"
android:paddingRight="13dp"
android:paddingTop="13dp"
android:text="Account"
android:textColor="#android:color/white"
android:textSize="11sp" />
</LinearLayout>
</TableRow>
</LinearLayout>
</LinearLayout>
How to remove the space between the grid view and below row of buttons
How to remove the space below gridview
Try below segment of code, replace with your code and pls check once.
<TableRow
android:id="#+id/DescriptionTitleRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="2sp" >
<GridView
android:id="#+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="80dp"
android:gravity="center"
android:numColumns="3"
android:scrollbars="horizontal"
android:stretchMode="spacingWidthUniform" >
</GridView>
</TableRow>
Related
I have this table:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="369dp"
android:layout_height="118dp"
android:layout_marginTop="224dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="A:" />
<TextView
android:id="#+id/q2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="15%" />
<TextView
android:id="#+id/q3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/editTextBackground"
android:layout_weight="1.5"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:textColor="#000000" />
<TextView
android:id="#+id/q4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="20%" />
<TextView
android:id="#+id/q5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
<TextView
android:id="#+id/q6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="25%" />
<TextView
android:id="#+id/q7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B:" />
<TextView
android:id="#+id/a2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="15%" />
<TextView
android:id="#+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
<TextView
android:id="#+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="20%" />
<TextView
android:id="#+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
<TextView
android:id="#+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="25%" />
<TextView
android:id="#+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
</TableRow>
</TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
How to make the columns closer together?
To make less space between 15% and underscore?
Used below codes
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="369dp"
android:layout_height="118dp"
android:layout_marginTop="224dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="A:" />
<TextView
android:id="#+id/q2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="15%" />
<TextView
android:id="#+id/q3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:textColor="#000000" />
<TextView
android:id="#+id/q4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="20%" />
<TextView
android:id="#+id/q5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
<TextView
android:id="#+id/q6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="25%" />
<TextView
android:id="#+id/q7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="B:" />
<TextView
android:id="#+id/a2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="15%" />
<TextView
android:id="#+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
<TextView
android:id="#+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="20%" />
<TextView
android:id="#+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
<TextView
android:id="#+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="25%" />
<TextView
android:id="#+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
</TableRow>
</TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Output :
I have this layout:
<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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="66dp"
android:layout_height="64dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/office_girl" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/greetingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Boss,"
android:textStyle="bold" />
<TextView
android:id="#+id/dailyStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="What to say if someone call?" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- android:layout_gravity="center" -->
<EditText
android:id="#+id/suto_sms_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:hint="Text"
android:inputType="textMultiLine"
android:lines="3" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_phone_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Phone Status"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Spinner
android:id="#+id/spinner_phone_status"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_busy_until"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="until"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Button
android:enabled="true"
android:id="#+id/button_set_date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="30dp"
android:text="#string/set_time" />
<TextView
android:enabled="true"
android:id="#+id/text_date_and_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="40dp"
android:textSize="12sp"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="#+id/button_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="#string/button_confirm" />
<Button
android:id="#+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="3dp"
android:text="#string/button_cancel" />
</LinearLayout>
</LinearLayout>
This is part of the output:
My question is how to align my Confirm and Cancel buttons (last part of the xml) to buttom of the screen?
I saw examples of how it can be done using relative layout, but my xml is quite big and i dont want to have to change it to relative layout as it will mean lots of work.
Thanks.
Try this code
<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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.9"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="66dp"
android:layout_height="64dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/greetingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Boss,"
android:textStyle="bold" />
<TextView
android:id="#+id/dailyStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="What to say if someone call?" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- android:layout_gravity="center" -->
<EditText
android:id="#+id/suto_sms_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:hint="Text"
android:inputType="textMultiLine"
android:lines="3" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_phone_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:text="Phone Status"
android:textSize="20sp" />
<Spinner
android:id="#+id/spinner_phone_status"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_busy_until"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:text="until"
android:textSize="20sp" />
<Button
android:id="#+id/button_set_date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="3dp"
android:enabled="true"
android:text="set_time" />
<TextView
android:id="#+id/text_date_and_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="3dp"
android:enabled="true"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.025"
android:baselineAligned="true"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/button_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="confirm" />
<Button
android:id="#+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cancel" />
</LinearLayout>
And here your using lot of LinearLayouts but personally i recommend you to try out relativelayout
Use the android:layout_gravity="bottom" attribute on the buttons as well as their containing LinearLayout.
Add
android:layout_weight="1"
in second last LinearLayout and
android:layout_weight="0"
in last LinearLayout. Hope this work for you.
It's actually very easy to use the RelativeLayout, because you can be very smart about it. For example, wrap it around everything, so that your current parent linear layout will be the first child, end put the linear layout with the buttons at outside of the current parent with the parameter alignParentBottom
Please see this:
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="66dp"
android:layout_height="64dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/plus" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/greetingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi Boss,"
android:textStyle="bold" />
<TextView
android:id="#+id/dailyStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="What to say if someone call?" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- android:layout_gravity="center" -->
<EditText
android:id="#+id/suto_sms_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:hint="Text"
android:inputType="textMultiLine"
android:lines="3" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_phone_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Phone Status"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Spinner
android:id="#+id/spinner_phone_status"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/text_busy_until"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="until"
android:layout_marginTop="3dp"
android:layout_marginLeft="5dp"
android:textSize="20sp" />
<Button
android:enabled="true"
android:id="#+id/button_set_date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="30dp"
android:text="set_time" />
<TextView
android:enabled="true"
android:id="#+id/text_date_and_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="40dp"
android:textSize="12sp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="#+id/button_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="confirm" />
<Button
android:id="#+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginLeft="3dp"
android:text="cancel" />
</LinearLayout>
</RelativeLayout>
I have the following layout:
<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"
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=".MainActivity" >
<EditText
android:id="#+id/etShowLog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="12"
android:textStyle="normal"
android:paddingLeft="2dip"
android:singleLine="false"
android:textColor="#999999"
android:textSize="14dip"
android:gravity="top"
android:layout_above="#+id/btnClear" />
<Button
android:id="#+id/btnClear"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_alignParentBottom="true" />
<Button
android:id="#+id/btnSave"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save Trip"
android:layout_gravity="right"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
</RelativeLayout>
Which displays this:
How do I edit the layout so I can display a listview underneath:
like this,remember to keep listview height in a fixer value or use weight
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_marginBottom="200dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button"/>
<LinearLayout
android:layout_width="0px"
android:layout_height="wrap_content" android:layout_weight="1">
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button2"/>
</LinearLayout>
</LinearLayout>
<ListView
android:layout_width="wrap_content"
android:layout_height="200dp"
android:id="#+id/listView" android:layout_gravity="center"
android:layout_marginTop="-200dp"/>
</LinearLayout>
Wrap your Buttons in a LinearLayout. Give the ListView
android:"#+id/myListView"
android:layout_alignParentBottom="true"
and the newly created LinearLayout
android:layout_above="#id/myListView
So something like this should get you close
<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"
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=".MainActivity" >
<EditText
android:id="#+id/etShowLog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="12"
android:textStyle="normal"
android:paddingLeft="2dip"
android:singleLine="false"
android:textColor="#999999"
android:textSize="14dip"
android:gravity="top"
android:layout_above="#+id/btnClear" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/myListView">
<Button
android:id="#+id/btnClear"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_gravity="left"/>
<Button
android:id="#+id/btnSave"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save Trip"
android:layout_gravity="right"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_gravity="left" />
</LinearLayout>
<ListView
android:id="#+id/myListView"
...
android:layout_alignParentBottom="true"
</RelativeLayout>
I also took out the RelativeLayout properties that were in the Buttons and added android:layout_graivty="left"
android:layout_gravity="right"
Here is an alternative (but possibly old, I wrote it a few years ago) layout that includes two side-by-side listviews at the bottom of the view. There are a load of internal views, but you should be able to extract/convert what you need?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent"
android:id="#+id/LinearLayout" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#color/darkGrey">
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableLayout01"
android:background="#color/darkGrey">
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow01">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout01">
<TextView android:id="#+id/strap" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:textSize="18sp"
android:text="Pace/Distance/Time\nCalculator" android:textColor="#color/white"
android:width="170dip" android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<Spinner android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="#+id/Spinner01"
android:layout_toRightOf="#+id/strap" android:prompt="#string/Presets" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow02">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout02">
<TextView android:id="#+id/topline1" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:text=" Hour" android:width="80dip" />
<TextView android:id="#+id/topline2" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline1" android:text="Mins"
android:width="80dip" />
<TextView android:id="#+id/topline3" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline2" android:text="Secs" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow03">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout03">
<EditText android:text="a" android:id="#+id/EditText01a"
android:layout_below="#+id/strap" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"
android:maxLength="2" android:inputType="number" />
<EditText android:text="b" android:id="#+id/EditText01b"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="2" android:inputType="number" />
<EditText android:text="c" android:id="#+id/EditText01c"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="6" android:inputType="numberDecimal" />
<Button android:layout_width="fill_parent" android:text="Time"
android:layout_height="wrap_content" android:layout_weight="1"
android:onClick="myClickHandler" android:id="#+id/Button01" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow04">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout04">
<TextView android:id="#+id/midline1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=" Enter Distance (miles)" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow05">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout05">
<EditText android:layout_height="wrap_content"
android:text="#+id/EditText02" android:layout_width="wrap_content"
android:id="#+id/EditText02" android:inputType="numberDecimal"
android:maxLength="8" android:width="120dip" />
<Button android:id="#+id/Button02" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_toRightOf="#+id/EditText02"
android:layout_below="#+id/midline1" android:text="Distance"
android:layout_marginLeft="103dip" android:width="100dip"
android:maxWidth="100dip" android:onClick="myClickHandler" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow06">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout06">
<TextView android:id="#+id/topline1" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:text=" Hour" android:width="80dip" />
<TextView android:id="#+id/topline2" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline1" android:text="Mins"
android:width="80dip" />
<TextView android:id="#+id/topline3" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline2" android:text="Secs" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow07">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout07">
<EditText android:text="a2" android:id="#+id/EditText03a"
android:layout_below="#+id/strap" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"
android:maxLength="2" android:inputType="number" />
<EditText android:text="b2" android:id="#+id/EditText03b"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="2" android:inputType="number" />
<EditText android:text="c2" android:id="#+id/EditText03c"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="6" android:inputType="numberDecimal" />
<Button android:layout_width="fill_parent" android:text="Pace"
android:layout_height="wrap_content" android:layout_weight="1"
android:onClick="myClickHandler" android:id="#+id/Button03" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow08"
android:background="#color/darkGrey">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout08"
android:background="#color/darkGrey">
<ListView android:id="#+id/ListView01"
android:layout_weight="1" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:background="#color/darkGrey" />
<ListView android:id="#+id/ListView02"
android:layout_weight="1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_toRightOf="#+id/ListView01"
android:background="#color/darkGrey2" />
</LinearLayout>
</TableRow>
</TableLayout>
I'm using table layout to show some data but the table starts from the edge of the phone from left to right. How do i do if i want the entire table at the center and some space on right and left. Please advice. Below is my code.
Code
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="2" >
<LinearLayout android:gravity="left" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="150dp"
android:layout_height="50dp"
android:src="#drawable/ezwaybill" />
</LinearLayout>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="150dp"
android:layout_height="50dp"
android:src="#drawable/van" />
</TableRow>
<LinearLayout android:gravity="center" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SENDER"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="22sp" />
</LinearLayout>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView1"
android:text="Account"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText1"
android:layout_span="2"
android:editable="false"
android:text="0001"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView3"
android:text="Tel"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText2"
android:layout_span="2"
android:editable="false"
android:text="01111022408615"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView5"
android:text="Add"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText3"
android:layout_span="2"
android:editable="false"
android:text="No. 7, Ferrers Park"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView5"
android:text="Country"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText4"
android:layout_span="2"
android:editable="false"
android:text="Malaysia"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView6"
android:text="Postcode "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText5"
android:layout_span="2"
android:editable="false"
android:text="44800"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView7"
android:text="Email"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText6"
android:layout_span="2"
android:editable="false"
android:text="customer#domain.com"
android:textSize="15sp" />
</TableRow>
<TextView
android:layout_width="10dp"
android:layout_height="10dp" />
</TableLayout>
</ScrollView>
use this code it look like as shown in image
<?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="#000000" >
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="2"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_gravity="center">
<LinearLayout android:gravity="left" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="150dp"
android:layout_height="50dp"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="150dp"
android:layout_height="50dp"
android:src="#drawable/ic_launcher" />
</TableRow>
<LinearLayout android:gravity="center" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SENDER"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="22sp" />
</LinearLayout>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView1"
android:text="Account"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText1"
android:layout_span="2"
android:editable="false"
android:text="0001"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView3"
android:text="Tel"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText2"
android:layout_span="2"
android:editable="false"
android:text="01111022408615"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView5"
android:text="Add"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText3"
android:layout_span="2"
android:editable="false"
android:text="No. 7, Ferrers Park"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView5"
android:text="Country"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText4"
android:layout_span="2"
android:editable="false"
android:text="Malaysia"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView6"
android:text="Postcode "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText5"
android:layout_span="2"
android:editable="false"
android:text="44800"
android:textSize="15sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:padding="2dip" >
<TextView
android:id="#+id/textView7"
android:text="Email"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<EditText
android:id="#+id/editText6"
android:layout_span="2"
android:editable="false"
android:text="customer#domain.com"
android:textSize="15sp" />
</TableRow>
<TextView
android:layout_width="10dp"
android:layout_height="10dp" />
</TableLayout>
</ScrollView>
Give your main View a Size and set android:layout_gravity="center". (Not sure if this works with Views). So they dont fill the Parent.
Else just give it a
android:layout_marginLeft="150dp"
android:layout_marginRight="150dp"
for example.
best regards
Below is the xml code ....
Friends Help me how to avoid space between scrollview and bottomLayout
Xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/addNewEventsCommonbg" >
<TextView
android:id="#+id/addNewEventsTitle"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentTop="true"
android:background="#drawable/dialog_title_bg"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvents"
android:textColor="#color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/addNewEventsTitleName"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_below="#+id/addNewEventsTitle"
android:background="#color/addNewEventsTitleNamebg"
android:drawableLeft="#drawable/mail_sent_icon"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvent"
android:textColor="#color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottomLayout"
android:layout_below="#+id/addNewEventsTitleName" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/addNewEventsEventLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvent"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsName"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsDateTimeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/addNewEventsDate"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<TextView
android:id="#+id/addNewEventsDate"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="#drawable/wedding_date_bg"
android:gravity="center"
android:text="#string/setDate"
android:textColor="#color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="#string/AddNewEventsTime"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<TextView
android:id="#+id/addNewEventsTime"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="#drawable/wedding_date_bg"
android:gravity="center"
android:text="#string/setTime"
android:textColor="#color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsAddressLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/address"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsAddress"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsAddressHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textPostalAddress"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsContactLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventContact"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsContacts"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsPhoneFaxLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventsPhone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsPhone"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:inputType="phone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="#string/AddNewEventsFax"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsFax"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:inputType="text|phone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsEmailLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/email"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsEmail"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEmailAddress"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsWebsiteLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventsWebsite"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsWebsite"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEditText"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<EditText
android:id="#+id/AddNewEventsComments"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsCommentsHeight"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:gravity="left"
android:inputType="textMultiLine"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottomLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="#+id/addNewEventsCancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/cancel_btn_selector"
android:text="#string/cancel"
android:textColor="#color/whiteColor"
android:textSize="18sp" />
<Button
android:id="#+id/addNewEventsSaveBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#drawable/save_btn_selector"
android:text="#string/save"
android:textColor="#color/whiteColor"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"// Gained the whole vertical space
android:layout_weight="1" // Adding weight makes another layout fix and adjustable after these
android:layout_above="#+id/bottomLayout"
android:layout_below="#+id/addNewEventsTitleName" >
Hope these might work!