Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Problem in setMargins() and textview

Problem in setMargins() and textview

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Problem in setMargins() and textview

Postby nithin.warier » Tue Nov 17, 2009 3:02 pm

Hi,

I created a textview and also MarginlayoutParams. Then i put setMargin
for the MarginLayoutParams and inserted that to textview using
tv.setLayoutparams(), but its not working.

The code is,

MarginLayoutParams compParams = new MarginLayoutParams
(MarginLayoutParams.WRAP_CONTENT,
MarginLayoutParams.WRAP_CONTENT);
compParams.setMargins(100, 100, 0, 0);
TextView tv = new TextView(this)
tv.setLayoutParams(compParams);
setContentView(tv);

But the textView is still in top left corner, its not moving.

Any suggestions please..

Thanks
smartandroidians.blogspot.com
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Top

Postby nithin.warier » Wed Nov 18, 2009 6:22 am

I tried in this way too, still no success


MarginLayoutParams compParams = new MarginLayoutParams
(MarginLayoutParams.WRAP_CONTENT,
MarginLayoutParams.WRAP_CONTENT);
compParams.topMargin=100;
compParams.leftMargin=100;
compParams.bottomMargin=0;
compParams.rightMargin=0;

//compParams.setMargins(100, 100, 0, 0);
TextView tv = new TextView(this)
tv.setLayoutParams(compParams);
setContentView(tv);

any idea please..

Thanks
smartandroidians.blogspot.com
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Postby nithin.warier » Wed Nov 18, 2009 11:27 am

Hi,

now, I am trying in this, still its not working...

LinearLayout layout = new LinearLayout(this);
LayoutParams layoutParams = new LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT);
layout.setLayoutParams(layoutParams);

MarginLayoutParams compParams = new MarginLayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
compParams.setMargins(50, 100, 0, 0);
TextView tv = new TextView(this);
tv.setText("Sample text");
tv.setLayoutParams(compParams);
layout.addView(tv);
setContetntView(tv);

// trial 2

compParams.leftMargin=50;
compParams.topMargin=100;
compParams.rightMargin=0;
compParams.bottomMargin=0;

tv.setLayoutParams(compParams);

this way also, not working...


any idea...
smartandroidians.blogspot.com
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Postby nithin.warier » Thu Nov 19, 2009 7:55 am

Hi,

I dont know, what I did till now, now all working fine..

I got the input from this link
http://developer.android.com/guide/samp ... omXml.html

the code I am working is,

layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(30, 10, 0, 0);
TextView tv = new TextView(this);
tv.setText("Sample text");
layout.addView(tv, layoutParams);
setContentView(layout);

Thanks
smartandroidians.blogspot.com
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests