How to develop Relative layout through code

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

How to develop Relative layout through code

Postby amitnargund » Thu Dec 25, 2008 7:38 am

Hi,

I am developing a form for which I need to develop the code through relative layout. Also the UI should be designed through coding only and not through XML.

Does anybody know how to do this?

I searched a lot on the internet, but could not find any sample code related to this.
amitnargund
Freshman
Freshman
 
Posts: 6
Joined: Thu Dec 25, 2008 7:34 am

Top

Postby mortefer » Thu Dec 25, 2008 11:16 am

Have you tried using addView methods (i.e. http://code.google.com/android/referenc ... iew,%20int))? Since UI elements are descendants of View it's possible to create a layout using that method. This is similar to java.awt methods if i'm not mistaken.
mortefer
Experienced Developer
Experienced Developer
 
Posts: 54
Joined: Sat Dec 20, 2008 11:24 am

Postby amitnargund » Mon Dec 29, 2008 12:32 pm

Hey thanks problem is resolved you have to use LayoutParams to actually set different attributes of the Layout.

THanks guys! :)
amitnargund
Freshman
Freshman
 
Posts: 6
Joined: Thu Dec 25, 2008 7:34 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests