Can we create Custom Layouts...in Android.

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

Can we create Custom Layouts...in Android.

Postby Andy » Wed Jan 07, 2009 10:53 am

Hi All,

Can we create Custom Layouts...in Android.

I don't want to use the layouts they have provided through XML.[Linear,Relative layouts etc..]


Regards,
Andy.
A n D r O i D
Andy
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri Dec 19, 2008 2:53 pm

Top

Postby MrSnowflake » Wed Jan 07, 2009 12:54 pm

Of course you can. You can even use your own layout in xml. Extend ViewGroup and you are going... You could use the source of ie LinearLayout for reference.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby Sparkletron » Wed Jan 07, 2009 11:42 pm

MrSnowflake wrote:Of course you can. You can even use your own layout in xml. Extend ViewGroup and you are going... You could use the source of ie LinearLayout for reference.


Sadly, it seems that there are significant layout properties that can only be accessed by inflating from XML (e.g., "layout_gravity"). Quite annoying for those of us who like to instantiate and extend objects in Java.

-S
Sparkletron
Developer
Developer
 
Posts: 26
Joined: Tue Nov 04, 2008 6:17 am

Postby Andy » Thu Jan 08, 2009 8:10 am

TQ for ur posts,

Can we make use of the components( Buttoons,Textbox...etc ) that we create in Xml, in a package different from the one which contains R.java file.

Because we will not get the Reference of the R.java file in different package .

Say we have different Packages.

com.android.p1
index.java
R.java
Login.java
com.android.p2
default.java
connect.java

If i want to make use of UIcomponents in xml by findViewById(R.id.<widget>) function or others..
can i have it ...currently i am having problem because R.java is in diffrent package.

Can we Reuse the UIComponents in XML by this?

Thanks in Advance......


Regards,
Andy.
A n D r O i D
Andy
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri Dec 19, 2008 2:53 pm

Postby MrSnowflake » Thu Jan 08, 2009 9:08 am

Of course from com.android.p2 you have access to R.java with com.android.p1.R. But keep in mind this will only work between 2 packages in the same apk.
And as a reminder: Don't use com.android for your own applications (but you probably knew this already).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests