RelativeLayout.LayoutParams ?!

0 Schubsi Du · October 13, 2015
I dont understand the Syntax of RelativeLayout.LayoutParams.

Here is everything i "know":

If u have a Class and u want to call a method of the Class it looks like this:

For Example Class is Car and Method is Drive().

-> Car.Drive();

But now RelativeLayout is a Parent Class and LayoutParams is a Child Class and is has the same Syntax like a Class.Method()?!

-> RelativeLayout.LayoutParams

I dont understand the last notation. or is layoutparams a method and not a child class?!

I appreciate your help a lot ! :)

Post a Reply

Replies

Oldest  Newest  Rating
+1 Gary Whitney · October 14, 2015
I copied this form #14 - Java Layout
 RelativeLayout.LayoutParams buttonDetails = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT
        );

You only use the keyword new with objects and object can contain inner objects.
Here he is passing two parameters to constructor.

So you are right that it appears to be a method, because that is what a constructor is.
  • 1

Java / Android Development

106,989 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator