I am trying to make a day-calendar and for that I am using a tablelayout and I then want to define a custom row(layout xml) containing TextViews to be able to access data here is and example of my table layout:
<TableLayout
android:id="@+id/appointmentListView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="@+id/tableRow1">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/unitNul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00"/>
<CustomRow><\CustomRow> //this is where I imagined I would have to put my custom element
</LinearLayout>
</TableRow>
I would then proceed to put in appointments based on their time of the day in the correct rows (via. switch logic)
My questions are:
How do I add a Custom element to each tablerow?
Is this the best way to do so?
side note:
I have tried to make a custom view element, but this seems to be a bit too dificult for me to handle. (this is also an option if you know a good guide explaining this)
I have already tried: http://developer.android.com/guide/topics/ui/custom-components.html
create an Xml like this::
then in activity class dynamically add rows and the other views like this;;
then in ur table(here “myTable”) add the row like this::