tablelayout - 3 rows x 4 columns - each cell with TextView,Editview and Spinner
Good Morning,
I am trying to design a layout and I am wondering if it possible at all.
I think I want a TableLayout with 3 rows and 4 columns. Then within each cell I want to have a TextView with an EditView below the TextView and then a spinner below the EditView. The objective is for a user to enter values and then select a unit of measurement, like inches or millimeters. The TextView is going to identify the name of parameter, the user then enters a number and selects the unit of measurement.
I first tried to get the three things (TextView, EditView and Spinner) to be underneath each other with no success. I can get the textview and the editview working but when I add the spinner it does not showup. I can get the TextView, EditView and two buttons working and I can get spinne开发者_高级运维rs working but for the life of me I can't get the TextView,EditView and Spinner working together although I get no errors when debugging or running. I trying this within a RelativeView so I can stack the 3 things together. My thought is that if I can get RelativeView working that I can then put it inside a tableview and get 3 rows of 4 inputs accross or 12 total parameters.
Does this make sense? Is this the right approach to create a way of inputting parameters, the reason I trying this instead of some linearview is I want to see all the values at one time on a nice grid like layout.
I anxiously await of assistance, thanks in advance!
Obviously I'm not getting into setting unique ids or layout height/widths for all the elements, but this is the structure:
<TableLayout>
<TableRow>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
</TableRow>
<TableRow>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
</TableRow>
<TableRow>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal">
<include layout="@layout/form_fields" />
</LinearLayout>
</TableRow>
</TableLayout>
Then your @layout/form_fields looks like this:
<LinearLayout
android:orientation="vertical">
<TextView />
<EditText />
<Spinner />
</LinearLayout>
精彩评论