Table layout without using Android XML

by Muthu Kumar K. » Tue, 03 Feb 2009 15:26:20 GMT


Sponsored Links
 Hi all,
Can any one help me how to create table layout with out using the
Android XML.

Thanks in Advance,
Muthu Kumar K.
--~--~---------~--~----~------------~-------~--~----~



Table layout without using Android XML

by Emmanuel » Wed, 04 Feb 2009 09:25:26 GMT


 Should MainLayout be the layout you want to add your Table Layout in,
and MyActivity, your activity ( odds are great that this one is simply
'this' ) :

TableLayout curTable = new TableLayout( MyActivity);
for (int i = 0; i < mNbRows; i++)
{
        TableRow CurRow = new TableRow( MyActivity );
        for (int j = 0; j < mNbColumns; j++)
        {
                // Add your content in your curRow here
                // for instance for a button :
                Button CurButton = new Button( MyActivity );
                CurRow.addView(CurButton);
        }
        curTable.addView( CurRow );
}
MainLayout.addView ( curTable );


Emmanuel
 http://androidblogger.blogspot.com/ 






--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Table layout without using Android XML

by Muthu Kumar K. » Wed, 04 Feb 2009 13:11:36 GMT


 Hi,
Thanks for your help, I got some idea.
But here I am trying to make use of the following XML,

<TableLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"

    android:layout_width="200dip"
    android:layout_height="200dip">

<TableRow>
    <TextView android:id="@+id/text1"
        android:layout_width="wrap_content"
                android:textSize="20dip"
        android:layout_height="wrap_content" />
</TableRow>
<TableRow android:gravity="left">

    <TextView android:id="@+id/text2"
        android:layout_width="250dip"
        android:layout_height="wrap_content" />
    <ImageView android:id="@+id/icon2"
            android:gravity="left"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <ImageView android:id="@+id/icon3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</TableRow>
<TableRow >
    <ImageView android:id="@+id/icon1"
                android:layout_gravity="left"
                android:padding="2dip"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</TableRow>

</TableLayout>


If possible can you help me how to write code equivalent to this XML??

Thanks in Advance,
Muthu Kumar K.





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to know the list of available extra for a intent ?

Hello,

how to know the list of available extra for a intent ?


For example, I want to know all available extra for
ACTION_BATTERY_CHANGED. What is the method to know them ?
 o I have seen nothing on the official dev guide, reference in
 http://www.***.com/ 
 o I have seen nothing on watching the intent on de{*filter*} (on Eclipse)
 o I have seen no methods on the intent documentation, like
myIntent.getListExra()


So, how ???


Thanks

-- 

2. Android developer site should provice current Android phones info...

I'm currently finding my self searching which devices are currently
out, in which countries, what current Android version they are running
and when they are scheduled for next update...

Where can I find this information?  It would really help developers
know this type of information to know what version to support or not
on my releases...

Anyone have any idea where this info can be found?

I think developer.android.com should have a spot for this...  And yes
I realize there are way to many companies using Android but I'm very
sure Google is keeping track of who is using their open source
code....

-Moto

-- 

3. I Didn't come here to cause no trouble, I just came to do the Android Market Shuffle!

4. Turning off SMS/MMS

5. How to send e-mail without user input

6. WebView not responding to touch events

7. how to play buffers in Media Player