If you are using a ListView, that is fairly simple.

Else,
You have two options...
1. Use Imageview as you are doing, if you dont want a Custom View
class.
2. Use a custom view class that draws everything, which is more
difficult.

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

On Sep 22, 9:35 pm, Kevin Courtney <kevinjcourt...@gmail.com> wrote:
> I'm not entirely sure if it's the draw method that I should be
> using..at this point I'm looking for any suggestions...
>
> ...I need to draw a line on the on this view using code.
>
> The rest of the story is that this code is inside a loop that is
> reading records and putting their info on the view.  In between each
> record I want to draw a simple line.
>
> Thanks,
>
> Kevin
>
> On Sep 22, 8:44 am, Kumar Bibek <coomar....@gmail.com> wrote:
>
> > 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 Bibekhttp://techdroid.kbeanie.com
>
> > On Sep 22, 5:53 pm, Kevin Courtney <kevinjcourt...@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to