Sunday, April 15, 2012

Re: [android-developers] xml ok - same android code fails

Which package does LayoutParam belong to? Is it ViewGroup?

Sent from my iPad

On 4 Apr 2012, at 00:33, alex b <alex_brambila@yahoo.com> wrote:

This xml in my layout file displays a line...

    <ImageView android:layout_width="320dp"
            android:layout_height="2dp"
            android:background="@drawable/bg_line"/>   

This code in my activity fails (notice the similarity to the xml above)....

            ImageView lbl=new ImageView(this);
            lbl.setLayoutParams(new LayoutParams(320,2));
            lbl.setBackgroundResource(R.drawable.bg_line);
            layout.addView(lbl);

All of my other code generated views display fine, just the line doesn't.  What gives?

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate