hogarth45
hogarth45

Reputation: 3677

TableRow not filling to the right

I'm trying to get this TableRow to fill all the way to the right side but am not having any luck. I believe that I've tried every combination of android:widths. So I'm giving to the experts. Screen shot and xml below: Tip: CTRL+F for "////" to jump to the TableRow in question.

enter image description here

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    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.hogarth45.smartestdiner.MainActivity$PlaceholderFragment"
    android:background="@drawable/sdback" >
<!--  
    <TableRow
        android:id="@+id/tableRow0"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:gravity="center_horizontal">

        <TextView
            android:id="@+id/textView1"
            android:layout_width="0dip"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/SD"
            android:textColor="#CC4D22"
            android:textSize="30sp"
            android:textStyle="bold"
            />

    </TableRow>    
 -->   
    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <EditText
            android:id="@+id/ZIPeditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/ZIP_txtview"
            android:inputType="number" >

            <requestFocus />
        </EditText>

        <Spinner
            android:id="@+id/Day_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/days_array" />

        <Spinner
            android:id="@+id/Choice_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/choice_array" />

        <Spinner
            android:id="@+id/Price_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/price_array" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/Submit_butt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/Submit_butt_txt" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:layout_weight="1">

        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_span="4"
             >
            <!--   android:padding="5dp"-->


            <TableLayout
                android:id="@+id/scrollytable"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:stretchColumns="yes"
                 >
                 <!--   android:padding="5dp"-->

                <!--   ///////////////Here is the row that is being clipped//////android:stretchColumns="1,2,1,1"/////////////////////////////////////////////    -->   

                     <TableRow
                        android:id="@+id/StockTableScrollView"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:stretchColumns ="*"
                        android:background="@android:color/transparent"
                         >

                        <TextView
                            android:id="@+id/Dinner_name_textView"

                            android:layout_height="wrap_content"
                            android:text="@string/eman"
                            android:layout_column="0"
                            android:textIsSelectable="true"
                            android:layout_width="0dip" 
                            android:paddingRight="3dp"
                            android:layout_weight="1" />

                        <TextView
                            android:id="@+id/Special_txtview"

                            android:layout_height="wrap_content"
                            android:text="@string/ceps"
                            android:layout_column="1"
                            android:textIsSelectable="true"
                            android:layout_width="0dip" 
                            android:layout_weight="3"/>

                        <Button
                            android:id="@+id/moreInfoButt"
                            style="?android:attr/buttonStyleSmall"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_column="2"
                            android:text="@string/Butt_txt_Info" />

                        <Button
                            android:id="@+id/WebButton"
                            style="?android:attr/buttonStyleSmall"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_column="3"
                            android:text="@string/Butt_txt_Map" />

                    </TableRow>
      <!--   //////////////////////////////////////////////////////////////////      -->      

            </TableLayout>   
        </ScrollView>

    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/ClearButt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/Clear_butt_txt" />

    </TableRow>

</TableLayout>

SOLVED

Changed the ScrollView to this

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="wrap_content"
     >

enter image description here

Upvotes: 0

Views: 117

Answers (1)

Ultimo_m
Ultimo_m

Reputation: 4897

Thats because your TableRow is inside a ScrollView and it will not match parent.

To achieve that you have to remove the ScrollView

Upvotes: 1

Related Questions