[TextView] What are that XML Attributes in JAVA ?

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

[TextView] What are that XML Attributes in JAVA ?

Postby darolla » Sun Apr 05, 2009 4:22 pm

Hi,

I need to programm this XML in JAVA. Some I figured out, some not. Can
you help me on the missing ones?

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <TextView android:layout_width="150px"
  2.  
  3. android:layout_height="wrap_content"
  4.  
  5. android:text="Bladidadi"
  6.  
  7. android:layout_gravity="center_vertical"
  8.  
  9. android:textColor="#ffffff" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. TextView tv = new TextView(this);
  2.  
  3. //android:layout_width="150px"
  4.  
  5. tv.setWidth(150);
  6.  
  7.  
  8.  
  9. //android:layout_height="wrap_content"
  10.  
  11. ???
  12.  
  13.  
  14.  
  15. //android:text="Bladidadi"
  16.  
  17. tv.setText("Bladidadi");
  18.  
  19.  
  20.  
  21. //android:layout_gravity="center_vertical"
  22.  
  23. tv.setGravity(Gravity.CENTER_VERTICAL);
  24.  
  25.  
  26.  
  27. //android:textColor="#ffffff"
  28.  
  29. tv.setTextColor(Color.rgb(0xff, 0xff,0xff));    // tv.setTextColor(0xffffff) doesn't work somehow
  30.  
  31.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Greetings,
DaRolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

re:

Postby shareme » Sun Apr 05, 2009 7:55 pm

We are probably thinking along similar lines as is if you can do it in java than the tha xml file can live outside of the app say on the sd card..ie skining OS/apps and etc

the only solution I have found thus far is to start going through andrloid source and noting what get and setter methods exist that correspond to xml attributes per class..

Oh those SweeterHome spring board panels..they are modified gallery widgets perhaps :)
shareme
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sun Nov 09, 2008 1:54 pm
Location: SE ChicagoLand

Postby xspotlivin » Mon Apr 06, 2009 2:27 am

Try something like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. tv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_CONTENT, LayoutParams.WRAP_CONTENT));
Parsed in 0.031 seconds, using GeSHi 1.0.8.4



You can use this for any layout you use (linear, absolute, table, etc.).

http://developer.android.com/search.html#q=layoutparams
xspotlivin
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 26, 2009 8:15 am
Location: Cambridge, MA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher, Yahoo [Bot] and 9 guests