TextView taller than containing TableRow after calling spinner.setdapter() in same row

60 Views Asked by At

I have a xml view that I'm inflating. I'm then doing a network call and with the results populating all these spinners. This is what the view looks like before I call setadapter on the spinners.

What View looks like before I call setadapter() on adjacent spinner

However, when I call spinner.setadapter(), my last TextView gets cut off. enter image description here

enter image description here

As you can see, the TextView is larger than the TableRow. Here is snippet of xml layout.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/bcast_table">

        <TableRow style="@style/row">
            <CheckBox style="@style/chbx"
                android:text="@string/title_num_retx"
                android:id="@+id/num_retx_chbx" />
            <Spinner style="@style/spinner"
                android:id="@+id/num_retx_spinner" />
        </TableRow>

        <TableRow style="@style/row">
            <CheckBox style="@style/chbx"
                android:text="@string/title_cwm0"
                android:id="@+id/cwm0_chbx" />
            <Spinner style="@style/spinner"
                android:id="@+id/cwm0_spinner" />
        </TableRow>
    </TableLayout>
</LinearLayout>

And here is how I setadapter()

    static void populateSpinner(int spinId, ArrayList<String> fields, String currPos, View template, Context context){
    Spinner spinner = (Spinner) template.findViewById(spinId);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
         android.R.layout.simple_spinner_item, fields);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    int position = adapter.getPosition(currPos);
    spinner.setSelection(position);
}

Thanks for the help!

0

There are 0 best solutions below