how to align the EditText to the layout? - android

Hi I have some problems with aligning the EditText in Android.
my 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"
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" >
<LinearLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal" >
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title goes here" />
</LinearLayout>
<TableLayout
android:id="#+id/middleSection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/header" >
<TableRow
android:id="#+id/userRow"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/userText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:id="#+id/userEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/passwordRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/passwordText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="#+id/passordEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:id="#+id/checkBoxRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/checkBoxBlank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "/>
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/checkBoxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Password"/>
</TableRow>
</TableLayout>
</RelativeLayout>
my output looks like this:
Username i__i
Password i__I
chBox Show Password
actually, I want to have:
Username i__________________i
Password i__________________i
chBox Show Password
I could not figure it out how to align it as I am new to Android(and XML)
thanks

add android:ems="10" to the EditText properties in the XML. The number 10 is an arbitrary number, and you can increase or decrease it depending on how long you want the EditText.
That, or you could just drag it longer to a relative point in the Graphical Layout tab of the XML.

use android:stretchColumns="*" in TableLayout tag that stretch column that you want
<?xml version="1.0" encoding="utf-8"?>
<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" >
<LinearLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal" >
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title goes here" />
</LinearLayout>
<TableLayout
android:id="#+id/middleSection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/header"
android:stretchColumns="1"
>
<TableRow
android:id="#+id/userRow"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/userText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:id="#+id/userEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/passwordRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/passwordText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="#+id/passordEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:id="#+id/checkBoxRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/checkBoxBlank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "/>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/checkBoxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Password"/>
</LinearLayout>
</TableRow>
</TableLayout>
</RelativeLayout>

Try this. It will work.
<RelativeLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="55dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title goes here"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<!--ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#android:drawable/sym_def_app_icon" /-->
</RelativeLayout>
<LinearLayout
android:id="#+id/middleSection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/header"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/userRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/userText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:id="#+id/userEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/passwordRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/passwordText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="#+id/passordEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:id="#+id/checkBoxRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
<TextView
android:id="#+id/checkBoxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Password"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/checkBoxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Password"/>
put your above code in one parent layout says Linearlayout like this:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/checkBoxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Password"/>
</LinearLayout>
what happening is you have 2 controls in each table row except last one which hase 3 controls in it so your EditText has its width according to the second control width that is your check box. so putting CheckBox and TextView in one Linear Layout consider it as a one control (or Layout) and your EditText adjusted according to that.

Related

Relative layout in android

I am a newbie in android who has started android just today.I am facing some problem in Layouts.
I want the layout to be as follows.
1(TextView) 2(TextView)
3(EditView) 4(EditView)
Here is what I have tried.The Top 1 & 2 represents TextView and 3
&4 represents EditView.Can we achieve this only with relative 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"
android:background="#drawable/amicare"
tools:context="com.example.ambulancetrack.MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/reg_no"
android:id="#+id/tvRegNo"
android:textColor="#21F6D0"
android:layout_toLeftOf="#+id/tvPhoneNo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RAHAT Phone No."
android:textColor="#21F6D0"
android:layout_alignParentRight="true"
android:id="#+id/tvPhoneNo"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tvRegNo"
android:background="#1E4F56"
android:textColor="#FFFFFF"
android:id="#+id/evRegNo"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/evRegNo"
android:background="#1E4F56"
android:textColor="#FFFFFF"
android:id="#+id/evPhoneNo"
/>
</RelativeLayout>
Please Help!!!Thanks in Advance
Ckeck this variant (in your case):
UPDATE:
<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"
android:background="#drawable/amicare"
tools:context="com.example.ambulancetrack.MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/reg_no"
android:id="#+id/tvRegNo"
android:textColor="#21F6D0"
android:layout_toLeftOf="#+id/tvPhoneNo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RAHAT Phone No."
android:textColor="#21F6D0"
android:layout_alignParentRight="true"
android:id="#+id/tvPhoneNo"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tvRegNo"
android:background="#1E4F56"
android:textColor="#FFFFFF"
android:id="#+id/evRegNo"
android:layout_toLeftOf="#+id/evPhoneNo"
android:layout_toStartOf="#+id/evPhoneNo" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tvPhoneNo"
android:layout_below="#+id/tvPhoneNo"
android:background="#1E4F56"
android:textColor="#FFFFFF"
android:id="#+id/evPhoneNo"
/>
Here is your 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"
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="com.example.ambulancetrack.MainActivity">
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvRegNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/tvPhoneNo"
android:layout_weight="1"
android:text="reg_no"
android:textColor="#21F6D0" />
<TextView
android:id="#+id/tvPhoneNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:text="RAHAT Phone No."
android:textColor="#21F6D0"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/layout1"
android:orientation="horizontal">
<EditText
android:id="#+id/evRegNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="#+id/tvRegNo"
android:layout_weight="1"
android:background="#1E4F56"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/evPhoneNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/evRegNo"
android:layout_weight="1"
android:background="#1E4F56"
android:textColor="#FFFFFF" />
</LinearLayout>
Test it and accept the answer if it is useful.
try this way
<RelativeLayout
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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="abce"
android:id="#+id/tvRegNo"
android:layout_toLeftOf="#+id/tvPhoneNo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RAHAT Phone No."
android:layout_alignParentRight="true"
android:id="#+id/tvPhoneNo"
/>
<EditText
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_below="#+id/tvRegNo"
android:hint="avc"
android:layout_alignParentLeft="true"
android:textColor="#FFFFFF"
android:id="#+id/evRegNo"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="avcd"
android:layout_toRightOf="#+id/evRegNo"
android:layout_alignParentRight="true"
android:layout_below="#+id/tvPhoneNo"
android:textColor="#FFFFFF"
android:id="#+id/evPhoneNo"
/>
</RelativeLayout>
Change main layout type to Linear with Vertical orientation. Then add 2 more Linear layout with Horizontal orientation inside and put your Textviews there. Use Weight attribute to control the size of each layout. Like that:
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="10"></LinearLayout>
</LinearLayout>
Add one more layout to you main Vertical layout and set it weight to 10, so it will take most space and your textviews will be close to each other. Dont forget to set android:layout_height="0dp"of your inner layouts to make weight work right.
You can archive this using LinearLayout also using android:layout_weight, like:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Text View 1" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Text View 2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Text View 3" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Text View 4" />
</LinearLayout>
</LinearLayout>
Your thinking is right,we can use one RelativeLayout to achieve your goal,but your last EditText's attrs maybe wrong.Please 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"
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:background="#drawable/amicare"
tools:context="com.example.ambulancetrack.MainActivity" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/reg_no"
android:id="#+id/tvRegNo"
android:textColor="#21F6D0"
android:layout_toLeftOf="#+id/tvPhoneNo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RAHAT Phone No."
android:textColor="#21F6D0"
android:layout_alignParentRight="true"
android:id="#+id/tvPhoneNo"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tvRegNo"
android:background="#1E4F56"
android:textColor="#FFFFFF"
android:id="#+id/evRegNo"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tvPhoneNo"
android:layout_below="#+id/tvPhoneNo"
android:background="#1E4F56"
android:textColor="#FFFFFF"
android:id="#+id/evPhoneNo"
/>
</RelativeLayout>
Just add
android:layout_alignLeft="#+id/tvPhoneNo"
android:layout_below="#+id/tvPhoneNo"
to make sure evPhoneNo layouts below of tvPhoneNo and align left of tvPhoneNo.
This should do the work. You can change text color and other attributes as you want.but this is the basic structure of your question
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="137dp"
android:text="EditView"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText2"
android:layout_alignTop="#+id/editText"
android:text="EditView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="TextView"
android:id="#+id/textView1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="TextView"
android:id="#+id/textView2"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>

How to increase the size of linear layout at run time programmatically?

I am using Android Studio. My project involves receiving some data through BLE and displaying it on the screen on a Linear Layout.
My main activity code for adding View:
dataLayout.addView(view, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
Function is defined as:
addView(dataEdit, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1));
In my xml file, the required portion looks like:
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:id="#+id/dataLayout"
android:fillViewport="true">
</LinearLayout>
EDIT:
The whole xml file looks like:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:focusable="true"
android:focusableInTouchMode="true"
android:baselineAligned="true">
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView2"
android:text="Find Device"
android:layout_marginTop="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/scanStatus" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Scan"
android:id="#+id/scan"
android:layout_gravity="center_horizontal"
android:enabled="false" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView4"
android:layout_marginTop="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/deviceInfo" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:text="Connect Device"
android:layout_marginTop="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/connectionStatus" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Connect"
android:id="#+id/connect"
android:layout_gravity="center_horizontal"
android:enabled="false" />
</LinearLayout>
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView7"
android:text="Receive"
android:textColor="#0B0101"
android:layout_marginTop="5dip" />
<Button
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Clear Data"
android:textColor="#FFFCFC"
android:id="#+id/clearData"
android:layout_gravity="center_horizontal"
android:singleLine="false" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView9"
android:text="Graphs"
android:layout_marginTop="5dip" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Plot"
android:id="#+id/Plot"
android:layout_weight="1"
android:layout_marginTop="2dip"
android:singleLine="false"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Distance:"
android:textColor="#0B0101"
android:id="#+id/textView8" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:id="#+id/dataLayout"
android:fillViewport="true">
</LinearLayout>
</LinearLayout>
</ScrollView>
The problem is that only first 9 values of received data are being displayed on the screen. After that, even when I scroll up the screen, I can't see any values. I want to scroll up the screen and see all the values being received.
Any help would be appreciated.
Wrapping your LinearLayout in a ScrollView should solve it. However, use a ListView or RecyclerView instead of adding views yourself. These recycle the views that are not visible to save memory.
Just wrap your root layout with a ScrollView (how to).
UPDATE
Try to update your layout in the following way:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:focusable="true"
android:focusableInTouchMode="true"
android:baselineAligned="true">
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView2"
android:text="Find Device"
android:layout_marginTop="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/scanStatus" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Scan"
android:id="#+id/scan"
android:layout_gravity="center_horizontal"
android:enabled="false" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView4"
android:layout_marginTop="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/deviceInfo" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:text="Connect Device"
android:layout_marginTop="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/connectionStatus" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Connect"
android:id="#+id/connect"
android:layout_gravity="center_horizontal"
android:enabled="false" />
</LinearLayout>
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView7"
android:text="Receive"
android:textColor="#0B0101"
android:layout_marginTop="5dip" />
<Button
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Clear Data"
android:textColor="#FFFCFC"
android:id="#+id/clearData"
android:layout_gravity="center_horizontal"
android:singleLine="false" />
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView9"
android:text="Graphs"
android:layout_marginTop="5dip" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Plot"
android:id="#+id/Plot"
android:layout_weight="1"
android:layout_marginTop="2dip"
android:singleLine="false"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Distance:"
android:textColor="#0B0101"
android:id="#+id/textView8" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:id="#+id/dataLayout">
</LinearLayout>
</LinearLayout>
</ScrollView>

XML Android layout problems

So I am having problems with some XML layout coding... I am supposed to replicate this image
but so far I seem to be only able to get this far and the checkout button refuses to stay to the right even when I do use android:gravity="right" to float right within its container... :/
This is the code I have so far:
<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=".CartActivity" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:text="Shopping Cart"
android:background="#android:color/holo_blue_dark" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#android:color/holo_blue_light"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subtotal:" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#800000"
android:text="£???" />
<Button
android:id="#+id/checkout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Checkout" >
</Button>
</LinearLayout>
</LinearLayout>
use a android:weightSum="3" for your inner
Layout with the three elements, and after that,
android:layout_weight="1" to each view
this will make the views to hold 1/3 of the available space
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#android:color/holo_blue_light"
android:weightSum="3"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subtotal:"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#800000"
android:text="£???"
android:layout_weight="1" />
<Button
android:id="#+id/checkout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Checkout"
android:layout_weight="1">
</Button>
</LinearLayout>
EDIT fill_parent is deprecated use match_parent
Try to use a Relativelayout
<RelativeLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Subtotal:" />
<TextView
android:id="#+id/textView2"
android:layout_toRightOf="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#800000"
android:text="£???" />
<Button
android:id="#+id/checkout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Checkout" >
</Button>
</RelativeLayout>

How to change height of scrollview to not overlap linear layout in android?

I have this xml layout, but the problem is that, in the scroll view, the height of it is spanning the whole screen and overlapping the bottom linear layout (drawing on top of it). Is there a way so that, I can get the scroll view height going only up to the linear layout on the bottom? I want the bottom 2 buttons to be aligned to the bottom of the screen.
Thanks
<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=".ActivityProfile" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/picture_avatar"
android:layout_width="90dp"
android:layout_height="310dp"
android:background="#bdbdbd"
android:src="#drawable/no_avatar" />
<TextView
android:id="#+id/textview_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="" />
</LinearLayout>
<TextView
android:id="#+id/textview_fullname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="" />
<TextView
android:id="#+id/textview_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="email"
android:text="" />
<TextView
android:id="#+id/textview_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:text="" />
<TextView
android:id="#+id/textview_website"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="" />
<TextView
android:id="#+id/textview_bio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:text="" />
<TextView
android:id="#+id/textview_lastactive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="#+id/textview_datejoined"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="#+id/textview_dateleft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="#+id/button_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="CloseActivity"
android:text="#+string/back" />
<Button
android:id="#+id/button_exit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="GoToEditProfile"
android:text="#+string/edit" />
</LinearLayout>
</RelativeLayout>
Change it to LinearLayout and use layout_weight :
<?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/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/picture_avatar"
android:layout_width="90dp"
android:layout_height="310dp"
android:background="#bdbdbd"
android:src="#drawable/no_avatar" />
<TextView
android:id="#+id/textview_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="" />
</LinearLayout>
<TextView
android:id="#+id/textview_fullname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="" />
<TextView
android:id="#+id/textview_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="email"
android:text="" />
<TextView
android:id="#+id/textview_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:text="" />
<TextView
android:id="#+id/textview_website"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="" />
<TextView
android:id="#+id/textview_bio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:text="" />
<TextView
android:id="#+id/textview_lastactive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="#+id/textview_datejoined"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="#+id/textview_dateleft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="#+id/button_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="CloseActivity"
android:text="#+string/back" />
<Button
android:id="#+id/button_exit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="GoToEditProfile"
android:text="#+string/edit" />
</LinearLayout>
</LinearLayout>
hope help you.
in your linear layout (at the bottom) add it to be situated below the scrollview
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal"
android:layout_below=""#+id/scrollView1" <-- this code
>
and also change the main base layout to linearlayout so it wont overlap
<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: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=".ActivityProfile"
android:orientation='horizontal'
>
dont forget to change the tab at the very end
</LinearLayout>

android tablelayout with complex component placement

EDITED: I HAVE FOUND THE SOLUTION MYSELF. THANK YOU!
I want to create the following screen for an Android App:
Right now I have this:
with this code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:weightSum="1" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight=".65"
android:weightSum="5" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TOURNAMENT: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp"/>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="GAME: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp" />
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="BEST OF: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp" />
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="BRACKET STYLE: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight=".35"
android:weightSum="5" >
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp" />
<RelativeLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1" >
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:text="CANCEL" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/button2"
android:text="CREATE" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
The text can be aligned to the right using android:gravity="right", but how can I make it
centered vertically?
--> AISHH, it's: android:gravity="center_vertical|right"
Thank you!!
Well TableLayout is not a good ideea. You should try using a RelativeLayout and some LinearLayout nested inside.
Try something like this:
<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:layout_alignParentTop="true"
android:id="#+id/first_linear"
android:orientation="vertical">
<!-- Note that for text view,and editText you might need to use certain values (dip values) cuz wrap content will try to arrange the view -->
<TextView
android:id="#+id/first_text_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText
android:id = "#+id/first_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<!-- we align all the following linearlayouts below the first -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/first_linear"
android:id="#+id/second_linear"
android:orientation="vertical">
<TextView
android:id="#+id/second_text_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText
android:id = "#+id/second_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<!-- add all the layouts like those from above -->
<!-- ...... -->
<!-- after you added all the fields you can add a linear layout containing two buttons to float below the last one -->
I've done a similar layout like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
android:layout_height="fill_parent" android:layout_width="fill_parent"
>
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
<LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="fill_parent">
<TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:stretchColumns="1" android:shrinkColumns="1">
<TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:text="Value1" android:gravity="right" />
<EditText android:singleLine="true" android:id="#+id/editTextVal1" />
</TableRow>
<TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:text="Long name value2" android:gravity="right" />
<EditText android:singleLine="true" android:id="#+id/editTextVal1" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.0">
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Save" />
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Cancel" />
</LinearLayout>
</LinearLayout>
There's a scroll panel in there to have the buttons on the bottom of the screen at all times, in case your configuration goes longer.
So this is the implementation I came up with. Not the best but worked for me :)
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight=".65"
android:weightSum="5"
android:paddingTop="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TOURNAMENT: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:gravity="center_vertical|right"/>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="GAME: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:gravity="center_vertical|right"/>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="BEST OF: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:gravity="center_vertical|right"/>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="BRACKET STYLE: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:gravity="center_vertical|right"/>
<!-- fill up the space so that the components on top are displayed correctly -->
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:gravity="center_vertical|right"/>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight=".35"
android:weightSum="5"
android:paddingTop="10dp" >
<EditText
android:id="#+id/tourName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left" />
<Spinner
android:id="#+id/spinGameName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left" />
<Spinner
android:id="#+id/spinBestOf"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left" />
<Spinner
android:id="#+id/spinBracketType"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left" />
<RelativeLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1" >
<Button
android:id="#+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:text="CANCEL" />
<Button
android:id="#+id/btnCreate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnCancel"
android:text="CREATE" />
</RelativeLayout>
</LinearLayout>

Categories

Resources