Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8689257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:36:01+00:00 2026-06-12T23:36:01+00:00

I am trying to make a day-calendar and for that I am using a

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:36:03+00:00Added an answer on June 12, 2026 at 11:36 pm

    create an Xml like this::

    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout
                android:id="@+id/tablerows"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@android:color/white"
                android:stretchColumns="0,1" >
            </TableLayout>
    
        </LinearLayout>
    
    </LinearLayout>
    

    then in activity class dynamically add rows and the other views like this;;

        TableRow row;
        TextView t1, t2;
        int dip = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,(float) 1,             getResources().getDisplayMetrics());
       row = new TableRow(context);
       row.setLayoutParams(new android.widget.TableRow.LayoutParams(android.widget.TableRow.LayoutParams.FILL_PARENT,
                    android.widget.TableRow.LayoutParams.WRAP_CONTENT));
    t1 = new TextView(context);
    t1.setTypeface(null, 1);
    t1.setTextSize(15);
    t1.setWidth(50 * dip);
    t1.setPadding(20*dip, 0, 0, 0);
    row.addView(t1);
    

    then in ur table(here “myTable”) add the row like this::

    myTable.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a custom Calendar view and for that I use
I am trying to make a jquery datepicker calendar that would highlight holidays and
I am trying to make a small sinatra example that will print a calendar
Have been struggling all day trying to make this simple example work using socket.io.
Recently I was trying to make a calendar application that will display the current
Good day. I'm trying to make an online quiz application using php. The idea
I follow a php book trying to make a calendar. Problem is that even
I'm trying to make an application to create a xml file and I want
I have spent the whole day trying to make a script which on submit
Good Day All we are trying to do is inside a trigger make sure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.