Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old February 5th, 2012, 07:47 AM   #1 (permalink)
New Member
 
Join Date: Dec 2010
Posts: 8
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default TableLayout problem

I need to create table layout with 2 cells (2 ImageButton) that equals and fit to full screen by height and width.

I tried differents options, params, but I can't create it.

My code:
PHP Code:
TableLayout tl = (TableLayoutfindViewById(R.id.colorLayout);
//        tl.setBackgroundColor(Color.RED);

        
TableRow row = new TableRow(this);
        
row.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENTLayoutParams.FILL_PARENT));
        
row.setGravity(Gravity.FILL);
        
        
row.setBackgroundColor(Color.BLUE);
//        row.setMinimumHeight(100);
//        row.setMinimumWidth(100);

        
ImageButton img = new ImageButton(this);
        
img.setBackgroundColor(Color.RED);
//        img.setScaleType(ScaleType.FIT_XY);
//        img.setLayoutParams(new TableLayout.LayoutParams(
//                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        
        
        
img.setMinimumHeight(100);
        
img.setMinimumWidth(100);
        
        
ImageButton img2 = new ImageButton(this);
        
img2.setBackgroundColor(Color.WHITE);
        
        
img2.setMinimumHeight(100);
        
img2.setMinimumWidth(100);
//        img2.setScaleType(ScaleType.FIT_XY);
//        img2.setLayoutParams(new TableLayout.LayoutParams(
//                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        
        
        
row.addView(img);
        
row.addView(img2);
        
//        row.addView(img, new TableLayout.LayoutParams(
//                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
//        row.addView(img2, new TableLayout.LayoutParams(
//                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        
        
        
tl.addView(row, new TableLayout.LayoutParams(
                
LayoutParams.FILL_PARENTLayoutParams.FILL_PARENT));
        
        return; 
whats wrong? Help me

tmlder is offline  
Reply With Quote
Sponsors
Old February 5th, 2012, 07:48 AM   #2 (permalink)
New Member
 
Join Date: Feb 2012
Posts: 1
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vegetarian Frozen Pizza
bonjovi00 is offline  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 12:13 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo