0

Im pretty new to Android Development, so after like three days of trying different things with the XML Layout Design, i give up and hope for help from you guys.

What i want to achieve:

A table layout with with multiple rows, each filled with calculations im making in the background

The first three rows shall contain the input parameters, the following ~12 rows shall contain output parameters

rows 3 to 6 shall be rearrangeable, so to speak change name and shown values.

This is the concept, thats what one row should look like:

enter image description here

My way of trying things was: Creating a TableRow for "Taupunkt" and "Td" and another one for three textfields and the +/- picture.

But how on earth am i supposed to insert the ">" arrows picture into the layout? Basically it should be centered between the rows.

I hope i did a clear explanation of my problem and hope that there is someone out there who can help me :)

PS.: App is going to support Android 4.0 and above

EDIT: As seen in the picture, how would i go about centering the plus/minus vertically to the textfields? Like, it should have the same space above and below it to the textfields

glace
  • 2,162
  • 1
  • 17
  • 23
  • Why don't you try Listview or RecyclerView? To make views dynamic they were introduced. And they are efficient than manually making stuffs dynamic because of caching – Jimit Patel Apr 13 '16 at 08:55
  • Are the chances high that i will be able to arrange the views per row in the fashion i want when using ListView? – glace Apr 13 '16 at 09:07
  • Yes very much and they are easy. You need to find out which row requires which layout. Check this link http://stackoverflow.com/a/4777306/842607 – Jimit Patel Apr 13 '16 at 09:08
  • You are my hero! Give me some kind of answer which i can mark as correct to give you some rep man! Pls look for edit in question. Need further information :D – glace Apr 13 '16 at 09:22
  • ± use this character or use ImageView – Jimit Patel Apr 13 '16 at 09:30
  • For sure im using ImageView, but the picture is smaller in height as the textfield. so how do i center it vertically regarding to the height of the textfield? – glace Apr 13 '16 at 09:32

1 Answers1

1

You can use ListView or RecyclerView as mentioned in comments.

For second question to make your view centrally aligned you can use android:gravity attribute in LinearLayout. Just made one same which is using center_vertical. Checkout -

<LinearLayout
                    android:id="@+id/btn_google"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/standard_padding"
                    android:background="@drawable/rectangle_round_red"
                    android:gravity="center_vertical"
                    android:minHeight="@dimen/standard_height"
                    android:orientation="horizontal">

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/icon_google" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:text="Google"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/font_18" />
</LinearLayout>

This is how it looks

enter image description here

Jimit Patel
  • 4,265
  • 2
  • 34
  • 58