Problem with EditText

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

Problem with EditText

Postby NithinG » Thu May 08, 2008 8:14 am

Hi all,
i am trying to display one EditText View, the code for that i am writing in java class instead of xml layout files.
But the problem is i am not able to move or positioning this View to any where in the screen. For that what function i have to use??
I tried with setPadding(). but its affecting to the text inside the EditText, not for EditText View.
The code is given below.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. EditText quantityValue = new EditText(this);
  2.  
  3.                         quantityValue.setSingleLine(true);
  4.  
  5.                         quantityValue.setText(""+quantityVector.get(j));
  6.  
  7.                         quantityValue.setTextColor(Color.BLACK);
  8.  
  9.                         quantityValue.setTextSize(12);
  10.  
  11.                         quantityValue.setMaxHeight(1);
  12.  
  13.                         quantityValue.setMaxWidth(1);
  14.  
  15.                         addContentView(quantityValue, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Anyone know about this problem please help me. :(

Thanks and regards,

NithinG
NithinG
Developer
Developer
 
Posts: 36
Joined: Wed Feb 27, 2008 6:24 am

Top

Postby plusminus » Fri May 16, 2008 11:07 am

Hello NithinG,

positioning something absolutely freely and anywhere on the screen can only be done using AbsoluteLayout.
This should be working(untested):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. EditText e = new EditText(this);
  2.  
  3.                 e.setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, xPos, yPos));
Parsed in 0.047 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Zeba Momin » Sat Dec 05, 2009 7:41 am

Hii...
How do I give border color to my EditText ??? :?:
Zeba Momin
Developer
Developer
 
Posts: 49
Joined: Thu Sep 17, 2009 6:53 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests