TableLayout layout params

by kingkung » Wed, 07 May 2008 17:51:42 GMT


Sponsored Links
 I understand the inherited structure of the LayoutParams (parent--
what I do:

XML:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:id="@+id/view_contact"
        xmlns:android=" http://schemas.android.com/apk/res/android" ;
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
</TableLayout>

JAVA:

        private void populateData(AndroidContact ac)
        {
                TableLayout tl = (TableLayout)findViewById(R.id.view_contact);

                TableRow tr = null;
                TextView tv=null;
                if (ac.name!=null)
                {
                        (tr = new 
TableRow(this)).setLayoutParams(tl.getLayoutParams());
                        (tv = new 
TextView(this)).setLayoutParams(tr.getLayoutParams());
                        tv.setText("Name: "+ac.name);
                        tr.addView(tv);
                        tl.addView(tv);
                }
      }

I've also tried:

        private void populateData(AndroidContact ac)
        {
                TableLayout tl = (TableLayout)findViewById(R.id.view_contact);

                TableRow tr = null;
                TextView tv=null;
                if (ac.name!=null)
                {
                        (tr = new TableRow(this)).setLayoutParams(new
TableLayout.LayoutParams());
                        (tv = new TextView(this)).setLayoutParams(new
TableLayout.LayoutParams());
                        tv.setText("Name: "+ac.name);
                        tr.addView(tv);
                        tl.addView(tv);
                }
      }


I don't understand anymore... *sigh*.


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



TableLayout layout params

by kingkung » Wed, 07 May 2008 18:40:41 GMT


 Never mind, I just used a vertical LinearLayout... much less prone to
restrictions IMHO.



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


Sponsored Links


Other Threads

1. XML: Can you create a button with a variable text field?

Hi. This is my first time posting and I am kind of a novice with XML.
So I want several classes to use an this XML layout with several
buttons. However, depending on the class, I want the text of the
buttons to say different things with different functionality. Is there
a way to display a button with varying text depending on a class that
is using the layout? Any help would be greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~

2. LogCat window doesn't work

Hi all,

LogCat window doesn't display anything?
I tried the following instruction :
________________________________________

Log.i("My Tag" ,"Informations") ;
________________________________________

what should i do ?

Thanx
jack
--~--~---------~--~----~------------~-------~--~----~

3. error downloading file requires sdcard

4. Bitmap.compress() always returns false if the bitmap is retrieved from a bundle

5. Coding conventions

6. trying to install, getting duplicate

7. Android tcp trouble