I want to add a relativelayout in linearlayout in my code: My code is:

class ViewLayout extends LinearLayout {

  ViewLayout(Context context)
  {
     ......
    try{
     RelativeLayout rel = new RelativeLayout(context);   // create rel
layout

     RelativeLayout.LayoutParams relLayout = new
RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
        relLayout.addRule(RelativeLayout.ALIGN_WITH_PARENT_TOP);
        relLayout.addRule(RelativeLayout.ALIGN_WITH_PARENT_LEFT);

       addView(rel, new
LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
        }
        catch(Exception e)
         {
         }
  }

}


The addView line crashes. Does anybody know how to add RelLayout in
LinearLayout?

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to