Ok, so it seems like I'm taking two steps forwards and 1 step back but
hopefully I'm just about there.

So I decided to create a custom RelativeLayout with an ImageView that
I add a custom checkbox to.  All seems to work well except now when I
try to access the ImageView using the following code:

      ImageView lightbulbImageView = (ImageView)
findViewById(R.id.lightBulbAnimation);

it returns null.  I inflate the RelativeLayout with the following code
before accessing the ImageView:

      LayoutInflater layout = getLayoutInflater();
      RelativeLayout tagInfoLayout =
(RelativeLayout)layout.inflate(R.layout.taginfo_layout, null);

Inside the taginfo_layout.xml file:

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android";
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

                <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@id/tagCheckbox"
                        android:id="@+id/lightBulbAnimation"
                        android:layout_gravity="center_vertical">
                </ImageView>

</RelativeLayout>

Am I on the right track in terms of having to inflate the layout
first?  If so, is there a reason why it's returning null when I try to
access the ImageView and if so how can I fix it?

Thanks.


On Sep 27, 4:38 pm, Wall-E <bashee...@gmail.com> wrote:
> Thanks, I'll try your suggestions.
>
> On Sep 27, 2:48špm, Kostya Vasilyev <kmans...@gmail.com> wrote:
>
>
>
> > If we are talking about "a list of checkboxes" inside a ScrollView, perhaps
> > it would make sense to use ListView?
>
> > +1 to RelativeLayout (in this case, for list view items).
>
> > --
> > Kostya Vasilyev --http://kmansoft.wordpress.com
>
> > 27.09.2010 22:30 ÐÏÌØÚÏ×ÁÔÅÌØ "TreKing" <treking...@gmail.com> ÎÁÐÉÓÁÌ:
>
> > On Mon, Sep 27, 2010 at 1:22 PM, Wall-E <bashee...@gmail.com> wrote:
>
> > > Any suggestions as to havin...
>
> > With RelativeLayout, you have to specify where each component will lie. So
> > you'll have to do it for eachcheckboxandimage.
>
> > However, probably a better way would be to have a sub-component that's just
> > thecheckboxandimageset up as you need, then add this sub-component as
> > one unit as necessary. Then you could use a RelativeLayout for the
> > sub-component, then use a LinearLayout to line up multiple instances of this
> > sub-component on separate lines.
>
> > There are usually many ways to go about laying out your GUI.That's one idea
> > based on what I understand of your specific needs so far.
>
> > --------------------------------------------------------------------------- 
> > ----------------------
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers"...

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