Hi Megha,
Thanks much. One more question. I now want to create a ViewGroup
object that handles several View objects with code using
AbsoluteLayout. Below is the code I wrote. However, I get "Cannot
instantiate the type ViewGroup" in defining vG. Could I prevail upon
you to indicate what code needs to be add?
Thanks,
Pfife
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
ViewGroup vG = new ViewGroup(this);
ImageView iV1 = new ImageView(this);
AbsoluteLayout mContentView1 = new AbsoluteLayout(this);
mContentView1.addView(iV1, new
AbsoluteLayout.LayoutParams( 68, 69, 100, 150));
iV1.setImageResource(R.drawable.face_c);
vG.addView(iV1);
ImageView iV2 = new ImageView(this);
iV2.setImageResource(R.drawable.face_e);
AbsoluteLayout mContentView2 = new AbsoluteLayout(this);
mContentView2.addView(iV2, new
AbsoluteLayout.LayoutParams( 68, 69, 200, 250));
vG.addView(iV1);
vG.addView(iV2);
setContentView(vG);
}
On Apr 7, 1:14 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Please go through the AbsoluteLayout
> documentation:http://code.google.com/android/reference/android/widget/AbsoluteLayou...
>
> You can add the following lines to your code:
>
> mContentView = new AbsoluteLayout(this);
>
> mContentView.addView(iV, new AbsoluteLayout.LayoutParams(68, //width
> 68, //height
> 100, //left
> 150); //top
> setContentView(mContentView);
>
> Thanks,
> Megha
>
>
>
> On Mon, Apr 7, 2008 at 12:31 PM, pfife <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I need to display an ImageView object in code to allow me to
> > dynamically reposition it. face_c is a gif file width and heightof 68
> > pixels. Using AbsoluteLayout what code should be added below to place
> > face_c at (100,150) to maintain its width and height of 68 pixels?
>
> > Thanks,
> > Pfife
>
> > public void onCreate(Bundle icicle) {
> > super.onCreate(icicle);
> > ImageView iV = new ImageView(this);
> > iV.setImageResource(R.drawable.face_c);
> > setContentView(iV);
> > }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Android Challenge" 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-challenge?hl=en
-~----------~----~----~----~------~----~------~--~---