No you can't. What you are doing is right. If I understand correctly,
you want to use the draw method to draw a line, am I correct?

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 22, 5:53 pm, Kevin Courtney <[email protected]> wrote:
> Hello,
>
> This seems like a basic question but I’ve been struggling with it and need
> another set of eyes to set me straight.
>
> I’m trying to draw a line using code in a RelativeLayout and it’s not
> showing up.  I have this XML file:
>
> <?xml version=*"1.0"* encoding=*"utf-8"*?>
>
> <shape xmlns:android=*"http://schemas.android.com/apk/res/android"*
>
> android:shape=*"line"*>
>
>     <stroke android:width=*"1dp"* android:colora=*"#0000FF"*/>
>
>     <size android:height=*"15dp"* />
>
> </shape>
>
> I use this file when drawing a line from straight XML and it works fine.
>
> But now I’m trying to use it to draw a line dynamically, in this code…
>
> ScrollView sv = *new* ScrollView(*this*);
>
>       RelativeLayout relativeLayout = *new* RelativeLayout(*this*);
>
>              relativeLayout.setBackgroundResource(R.drawable.*gradient_box*
> );
>
>       sv.addView(relativeLayout);
>
>       ImageView imageLineView2 = *new* ImageView(*this*);;
>
>       imageLineView2.setBackgroundResource(R.drawable.*dividing_line_1*);
>
>       RelativeLayout.LayoutParams lpEndOfInfoLineId2 =
>
>        *new* RelativeLayout.LayoutParams(
>
> *           *RelativeLayout.LayoutParams.*WRAP_CONTENT*,
>
>      RelativeLayout.LayoutParams.*FILL_PARENT*);
>
>       relativeLayout.addView(imageLineView2,lpEndOfInfoLineId2);
>
>       // have buttons, text, and images here that show up fine.
>
>       *this*.setContentView(sv);
>
> It uses the same background as my successful use from the XML file so I
> don’t think it’s blending into the background.
>
> Do any of you have any suggestions on what I’m missing?
>
> Thanks in advance,
>
> Kevin

-- 
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