I am trying this in two ways

(a) defining my custom view as part of the Layout file. When the app runs
and activity loads this layout. The custom View runs and displays the
content in its position.  The enclosing layout of my custom view could be
any layout not just Linear.  For example, if enclosing layout was linear,
and has something like this
1.TextView,
2 Spinner
3. CustomView
4. TextView
Each view takes the size of its content vertically including the
customView.  so  the output on the screen would in the order mentioned
above, based on the size CustomView may even push the (4) out of the window
downwards.

I am not sure if what I am trying above is even possible, because I am
defining in the layout to behave certain way and then trying to change it at
runtime.

(b) the second case is, instead of defining it as part of the layout, I am
creating the customView in the onCreate of the Activity and adding it as
addContentView(view) method. What this is doing is, instead of adding it to
the end of of the layout, which I was expecting. CustomView appears at 0,0,
(top, left) drawing on top of  the textview(1) listed above. With this
approach I am able to overlay my customView on every other view and based on
the content size it is taking as much vertical space as needed.

In this case, What I would like to know is, I could not find a way to truly
add dynamically created CustomView to the layout wherein I can insert it in
the order mentioned above from Activity.  Is there an api like that?

Thanks,
Ravi.

On Mon, Apr 20, 2009 at 3:11 AM, Android Users <[email protected]>wrote:

> Just let me know if i have understood right.
>
> U have a layout say having 3 views. Dynamically if u add a view, the layout
> should get adjusted accordingly and if u keep only one view in the layout
> then the single view should fill the whole layout.
>
> If thats right, the try setting layout weight for each view, summing upto
> 1.0f.
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to