Make TableRows even width - java

Below is what my screen looks like:
You can see that in row 1, the two buttons are not aligned evenly since the right box is 2 lines and the left box is 1 line. Also, you can see in row 3 that the buttons are wider since they are both 3 lines each.
Is there a way to make the rows the same height? Sort of like how in a LinearLayout you can use android:layout_width="#". I have posted all the code in my XML since it is relatively short.
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativelayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="1dp"
android:paddingBottom="50dp"
android:background="#drawable/scroll" >
<TextView
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="14sp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingTop="65dp" />
<TextView
android:id="#+id/subHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/header"
android:textStyle="italic|bold"
android:textSize="12sp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingBottom="20dp" />
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/subHeader"
android:layout_alignParentBottom="true"
android:background="#drawable/scrollviewborder"
android:fillViewport="true"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/jc"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
<Button
android:id="#+id/tencommandments"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/exodus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
<Button
android:id="#+id/genesis"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/holydays"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
<Button
android:id="#+id/facts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/random"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
</TableLayout>
</RelativeLayout>

Here's your layout, redone. You're going to want to add the lines referring to your drawables in -- I took them out since I didn't have access to them. Pay attention to how the values for weight are fractional, and think of the amount of space available to a widget within a container in terms of a percentage of that space. This paradigm shift should elevate your understanding of the weight attribute.
Also, try to avoid using fill_parent, which has been deprecated in favor of match_parent in API 8 and above unless your really want to support old, moldy versions of Android (less than 1% of the installed base).
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativelayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="1dp"
android:paddingBottom="50dp" >
<TextView
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="14sp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingTop="65dp" />
<TextView
android:id="#+id/subHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/header"
android:textStyle="italic|bold"
android:textSize="12sp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingBottom="20dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/subHeader"
android:layout_alignParentBottom="true"
android:fillViewport="true"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp" >
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".25" >
<Button
android:id="#+id/jc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:textStyle="bold"
android:textSize="14sp" />
<Button
android:id="#+id/tencommandments"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".25" >
<Button
android:id="#+id/exodus"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:textStyle="bold"
android:textSize="14sp" />
<Button
android:id="#+id/genesis"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".25" >
<Button
android:id="#+id/holydays"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:textStyle="bold"
android:textSize="14sp" />
<Button
android:id="#+id/facts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".25" >
<Button
android:id="#+id/random"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="14sp" />
</TableRow>
</TableLayout>
</RelativeLayout>

Try to change android:layout_height="wrap_content" to match_parent in your button with the id jc.

Related

center content in a simple legend layout

I build a layout that overflows the google maps and it look like that: image
so the problem that i get with the layout on the bottom is that i can't center all the conter it stays too much on the left side and i don't know really why.
I want to center the content but mantain the space with each elemnt(i consider the element the background color + the text).
How can i do it?
here is my xml(that contains the map and the layout):
<FrameLayout 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">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.afcosta.inesctec.pt.android.MapsActivity" />
<LinearLayout
android:id="#+id/newmarker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFFFFFFF"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:paddingBottom="10dp"
android:layout_weight="1"
android:text="Legenda"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:id="#+id/rand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFFFFFFF"
android:gravity="center"
android:weightSum="3"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/myPos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#FFFFFFFF"
android:orientation="horizontal">
<Button
android:id="#+id/newmarker_save1"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/red" />
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="5dp"
android:text="Utilizador" />
</LinearLayout>
<LinearLayout
android:id="#+id/allFotos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#FFFFFFFF"
android:orientation="horizontal">
<Button
android:id="#+id/newmarker_save2"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/emerald" />
<TextView
android:id="#+id/Fotos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="5dp"
android:text="Fotos" />
</LinearLayout>
<LinearLayout
android:id="#+id/Photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:background="#FFFFFFFF"
android:gravity="center_horizontal"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="#+id/button2"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/yellow" />
<TextView
android:id="#+id/textView9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:layout_weight="1"
android:text="Planta" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
thanks!
You have to wrap_content your Button and you TextView, remove android:layout_weight="1" from the textView that lives beside your Button, then finally make sure that every single LinearLayout that wraps your Button and TextView are flagged as android:gravity="center" (this gravity is gonna be applied for its childs)
Also I strongly advise you replacing these linear layouts for Relatives to reduce your UI hierarchy
Try this.
<FrameLayout 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">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.afcosta.inesctec.pt.android.MapsActivity" />
<LinearLayout
android:id="#+id/newmarker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFFFFFFF"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:paddingBottom="10dp"
android:layout_weight="1"
android:text="Legenda"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:id="#+id/rand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFFFFFFF"
android:gravity="center"
android:weightSum="3"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/myPos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:layout_weight="1"
android:background="#FFFFFFFF"
android:orientation="horizontal">
<Button
android:id="#+id/newmarker_save1"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/colorAccent" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="Utilizador" />
</LinearLayout>
<LinearLayout
android:id="#+id/allFotos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#FFFFFFFF"
android:orientation="horizontal">
<Button
android:id="#+id/newmarker_save2"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/colorAccent" />
<TextView
android:id="#+id/Fotos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="Fotos" />
</LinearLayout>
<LinearLayout
android:id="#+id/Photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:background="#FFFFFFFF"
android:gravity="center_horizontal"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="#+id/button2"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/colorAccent" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="Planta" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
I presume that's what you want, right?

Android studio , how to align multiple text view and edit texts in linear layout(horizontal)

I'm a beginner in android development, my project requires me to build a simple UI app using two fragments (home and field). The home will show the starup page with 5 buttons. when we click on these buttons, it will then call field fragment and show fields like:
conductivity:----,height:----
and etc to fill up, like inserting manual data.
my issue here is , the project requires me to use linearlayout in horizontal alignment for the field frag, when i do that and add edit text and text views, its lined in same line as horizontal, but what i need is it to appear one and the other below it: SOme thing like
conductivity(text view): ___________(editText)
[another line]
height(text view):________(editText)
and so on. SOrry this might be a simple issue but i have been stuck on this for 2 days now. Help me
my code for field fragment.xml is as follows:
<?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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hp1_textView"
android:id="#+id/hp1_textView"
android:textSize="32sp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/hp1_textView"
android:layout_centerHorizontal="true"
android:id="#+id/linearLayout">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/conductivity"
android:id="#+id/textView"/>
<EditText android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:layout_weight="1"
android:hint="#string/conductivity_field" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="pH:"
android:id="#+id/textView2" />
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText2"
android:layout_weight="1"
android:hint="0.-14" />
</LinearLayout>
</RelativeLayout>
THis is how i want it to display
Use this xml in your code as it is
<?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="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="2">
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Conductivity (uS): "
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="745.2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="2">
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="pH: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="7.1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="2">
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Moisture(%): "
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="0-100" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="2">
<TextView
android:id="#+id/textVie4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:text="Dissolved oxygen(ppm): "
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="0-100" />
</LinearLayout>
<Button
android:id="#+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="5dp"
android:text="Save Log Entry" />
<Button
android:id="#+id/btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="5dp"
android:text="Show Log Entry" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="3">
<Button
android:id="#+id/btn3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:padding="5dp"
android:text="Previouse" />
<Button
android:id="#+id/btn4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:padding="5dp"
android:text="Next" />
<Button
android:id="#+id/btn5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:padding="5dp"
android:text="Home" />
</LinearLayout>
</RelativeLayout>
I hope its solve your problem.....
Try below with android:weightSum and LinearLayout with android:orientation
<?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">
<TextView
android:id="#+id/hp1_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="hp1"
android:textSize="32sp" />
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="12">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:id="#+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="conductivity"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:hint="conductivity_field" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="pH:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:hint="0.-14" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="#+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Moisture(%):"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:hint="0-100" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:id="#+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Disolved Oxygen(ppm)"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editText4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:hint="0-100" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="2"
android:orientation="vertical"
android:weightSum="2">
<Button
android:id="#+id/Button11"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center"
android:text="Save log entry"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/Button12"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center"
android:hint="Show log entries"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="3">
<Button
android:id="#+id/Button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center"
android:text="conductivity"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/Button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:hint="conductivity_field" />
<Button
android:id="#+id/Button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:hint="conductivity_field" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
If my understanding of your scenario is correct, to display them one below the other as in the image you have supplied, the orientation of the linearLayout must be set to vertical. If you use orientation horizontal the drawing of widgets will falls to the next line, only after it has drawn widgets completely all the way up to the width of your phone( and then it jumped to the next line) .So the LinearLayout should be changed to vertical orientation
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/hp1_textView"
android:layout_centerHorizontal="true"
android:id="#+id/linearLayout">

LinearLayout on android

I was trying to create a sign up form for my Android application
This is my XML code
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="#+id/mynumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Number +961"
android:textSize="20sp"
android:color="#android:color/white" />
<EditText
android:id="#+id/editTextNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Number"
android:textColor="#FFFFFF" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" >
<Button
android:id="#+id/buttonCreateAccount"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="60dp"
android:background="#drawable/ic_create" />
</LinearLayout>
</LinearLayout>
If you notice the first LinearLayout has a horizontal orientation and gravity (I want both the textview and edit text to be next to each others)
After the first linear layout i want the create account button to come out
However it is showing up on the same line with the previous edit text and text view
Any idea if i should change in the settings of the second linear layout
Change it like this
<LinearLayout
android:gravity="center_horizontal"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<LinearLayout
android:gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal">
<TextView
android:color="#android:color/white"
android:id="#+id/mynumber"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Number +961"
android:textSize="20sp" />
<EditText
android:hint="Number"
android:id="#+id/editTextNumber"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#FFFFFF" />
</LinearLayout>
<Button
android:background="#drawable/ic_create"
android:id="#+id/buttonCreateAccount"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:layout_width="fill_parent" />
</LinearLayout>
Try Below Xml File
Use Relative layout Or One MAin LinearLayout with Vertical Orientation and in sub take Horizontal as you required.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="#+id/mynumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Number +961"
android:textSize="20sp"
android:color="#android:color/white" />
<EditText
android:id="#+id/editTextNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Number"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="#+id/buttonCreateAccount"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="60dp"
android:background="#drawable/ic_create" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/sign">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="1200dp">
<TableLayout
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Signup for Juju's"
android:textSize="35dp"
android:textColor="#f45"
android:textStyle="bold" />
<TableRow
android:weightSum="20"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:id="#+id/nametv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First Name"
android:textSize="25dp"
android:textColor="#23f" />
<EditText
android:textSize="16dp"
android:layout_marginRight="5dp"
android:layout_weight="15"
android:id="#+id/name"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Enter your name" >
</EditText>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:weightSum="20"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:textColor="#23f"
android:id="#+id/emailtv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:textSize="25dp" />
<EditText
android:textSize="16dp"
android:layout_weight="15"
android:layout_marginRight="5dp"
android:id="#+id/email"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Enter E-mail" />
</TableRow>
<TableRow
android:weightSum="20"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:textColor="#23f"
android:id="#+id/phonetv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone"
android:textSize="25dp" />
<EditText
android:textSize="16dp"
android:layout_marginRight="5dp"
android:layout_weight="15"
android:id="#+id/phone"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Enter Phone Number" />
</TableRow>
<TableRow
android:weightSum="20"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:textColor="#23f"
android:id="#+id/addresstv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:textSize="25dp" />
<EditText
android:textSize="16dp"
android:layout_marginRight="5dp"
android:layout_weight="15"
android:id="#+id/address"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Enter Address" />
</TableRow>
<TableRow
android:weightSum="20"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:textColor="#23f"
android:id="#+id/usernametv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username"
android:textSize="25dp" />
<EditText
android:textSize="16dp"
android:layout_weight="15"
android:layout_marginRight="5dp"
android:id="#+id/username"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Username" />
</TableRow>
<TableRow
android:weightSum="20"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:textColor="#23f"
android:id="#+id/passwordtv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
android:textSize="25dp" />
<EditText
android:textSize="16dp"
android:layout_marginRight="5dp"
android:layout_weight="15"
android:id="#+id/password"
android:inputType="textPassword"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Password" />
</TableRow>
<TableRow
android:weightSum="20"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_weight="5"
android:textColor="#23f"
android:id="#+id/confirmtv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reenter"
android:textSize="25dp" />
<EditText
android:textSize="16dp"
android:layout_marginRight="5dp"
android:layout_weight="15"
android:inputType="textPassword"
android:id="#+id/confirm"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:hint="Confirm Password" />
</TableRow>
<CheckBox
android:id="#+id/view_password"
android:checked="false"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="View Password"
android:textColor="#000"/>
<ImageView
android:clickable="true"
android:id="#+id/submit"
android:layout_gravity="center"
android:layout_width="122dp"
android:layout_height="74dp"
android:src="#drawable/button" />
</TableLayout>
</ScrollView>
</LinearLayout>
Change your layout type;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
Definitely. What your are doing is encapsulating the second LinearLayout inside the first LinearLayout, that dictates a horizontal layout, ultimately resulting in horizontal positioning of all three components. Your hierarchy is as follows:
LinearLayout-Horizontal[TextView + EditText + LinearLayout-Vertical[Button]]
When supplying a LinearLayout with an orientation parameter, you're telling it to arrange all its children in that manner.
What I would recommend to you, to achieve the desired look is either:
Use a RelativeLayout (http://developer.android.com/guide/topics/ui/layout/relative.html) and position the elements in relation to each other and their parent.
Nest several LinearLayouts(not a recommended practice; here it wouldn't prove an issue but in larger and more complex layouts nesting too many such components may ultimately result in long rendering time for your view). This solution is pretty similar to what you have now and would work as follows:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/mynumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Number +961"
android:textSize="20sp"
android:color="#android:color/white" />
<EditText
android:id="#+id/editTextNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Number"
android:textColor="#FFFFFF" />
</LinearLayout>
<Button
android:id="#+id/buttonCreateAccount"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="60dp"
android:background="#drawable/ic_create" />
</LinearLayout>
Here you tell your outer layout to position its children vertically, where one of its children is a LinearLayout that positions its children horizontally, resulting in:
[[TEXT][EDIT]]
[ BUTTON ]
Hope this helps.

LinearLayout and FrameLayout for positioning buttons

I tried to figure this out on my own for hours already and just can't make it. Here it what I am trying to do: Image of desired layout
The "blue" rectangle is the area the TextSwitcher is supposed to encompass, but I can't manage to put the "Redo Set" directly above the "Previous Item" and the "Next Set" directly above the "Next Item" button. Here is my layout xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Spinner
android:id="#+id/spinner_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="#+id/spinner_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="#+id/spinner_3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextSwitcher
android:id="#+id/textSwitcherMain"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="40sp"
android:keepScreenOn="true"
android:text="" >
</TextSwitcher>
<Button
android:id="#+id/problematicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|top"
android:visibility="visible"
android:text="#string/problematic" />
<Button
android:id="#+id/playButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|top"
android:visibility="visible"
android:text="#string/play_1" />
<Button
android:id="#+id/nextSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:visibility="visible"
android:text="#string/next_set" />
<Button
android:id="#+id/redoSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"
android:visibility="visible"
android:text="#string/redo_set" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="#+id/previousButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/previous_item_button" />
<Button
android:id="#+id/nextButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/next_item_button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<com.google.android.gms.ads.AdView
ads:adUnitId="**************"
ads:adSize="SMART_BANNER"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center" />
</LinearLayout>
I tried putting nextButton and previousButton in the FrameLayout, but then they overlap with redoSetButton and nextSetButton respectively. Also, nextButton and previousButton should each take up 50% of the width, so I somewhat have to put it into a LinearLayout and I tried putting various combinations inside the FrameLayout, but I can't manage to position those buttons in this way.
Furthermore, it's important that all those buttons are on top of the TextSwitcher, because it will have a background image/colouring that should be visible behind the buttons.
This is my first posting. I hope I was detailed enough. Thanks for your input in advance.
Try this way,hope this will help you to solve your problem.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Spinner
android:id="#+id/spinner_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="#+id/spinner_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="#+id/spinner_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextSwitcher
android:id="#+id/textSwitcherMain"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="40sp"
android:keepScreenOn="true"
android:text="" >
</TextSwitcher>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top">
<Button
android:id="#+id/problematicButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/problematic" />
<Button
android:id="#+id/playButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/play_1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<Button
android:id="#+id/nextSetButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/next_set" />
<Button
android:id="#+id/redoSetButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/redo_set" />
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="#+id/previousButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/previous_item_button" />
<Button
android:id="#+id/nextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/next_item_button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<com.google.android.gms.ads.AdView
ads:adUnitId="**************"
ads:adSize="SMART_BANNER"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>

RelativeLayout inside of ScrollView - Android

I am changing my whole layout for this activity from a TableLayout to RelativeLayout for various reasons. I have 10 "rows" I want inside of this RelativeLayout but right now I am just trying to get one row working. After that 1 row is working, I will implement the other 9.
There are 4 columns in each row and right now only the first column is displaying and not the last 3. Below is the code and screenshot. The "red x" is the first column that is displaying.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/tableLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:shrinkColumns="0"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="70dp"
android:paddingBottom="70dp"
android:background="#drawable/scroll" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="20" >
<TableRow
android:id="#+id/header"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/category"
android:layout_height="wrap_content"
android:layout_width="0px"
android:layout_weight="1"
android:textStyle="bold"
android:textSize="15sp"
android:paddingTop="10dp"
android:gravity="center_horizontal" />
<TableLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TableRow
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/points"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:textSize="9sp"
android:gravity="left"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/percentage"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".3"
android:textSize="9sp"
android:gravity="left"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/total_score"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".45"
android:textSize="9sp"
android:gravity="left"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#000001" />
<TableRow
android:id="#+id/row3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/imageColumn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0" />
<TextView
android:id="#+id/questionColumn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".45"
android:textSize="10sp"
android:textStyle="bold|italic"
android:gravity="center_vertical" />
<TextView
android:id="#+id/answerColumn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".3"
android:textSize="10sp"
android:textStyle="bold|italic"
android:gravity="center_vertical" />
<TextView
android:id="#+id/verseColumn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:textSize="10sp"
android:textStyle="bold|italic"
android:gravity="center_vertical" />
</TableRow>
</TableLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="65"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/q1Image"
android:layout_width="10dp"
android:layout_height="10dp" />
<TextView
android:id="#+id/q1Question"
android:layout_width="0dip"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/q1Answer"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/q1Question" />
<TextView
android:id="#+id/q1Verse"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/q1Answer" />
</RelativeLayout>
</ScrollView>
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="15" >
<TableRow
android:id="#+id/row14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,1" >
<Button
android:id="#+id/mainmenuBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:id="#+id/highscoresBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:id="#+id/playBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
</TableRow>
</TableLayout>
</LinearLayout>
If I read it correctly and you are referring to this ScrollView:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="65"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/q1Image"
android:layout_width="10dp"
android:layout_height="10dp" />
<TextView
android:id="#+id/q1Question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/q1Image" />
<TextView
android:id="#+id/q1Answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/q1Question" />
<TextView
android:id="#+id/q1Verse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/q1Answer" />
</RelativeLayout>
</ScrollView>
Your TextView's layout_width was set to 0dip when you need a wrap_content or static width. Also your TextView q1Question was not attached to the right of ImageView q1Image. Unless of course you wanted it stacked ontop of the ImageView.
Looks like your views inside of your imageView have a width of 0dip and no weight. Could you correct that ?
Also, you could remove the weights on the TableRows and set them to match_parent.

Categories