Any suggestions anyone?

On Sep 2, 10:22 pm, Chris Cicc <[EMAIL PROTECTED]> wrote:
> Hey,
> I appreciate the prompt reply. Unfortunately I'm having trouble making
> complete sense of your instructions. I admit I'm new to Java and
> Android (though I'm very experienced in C#.NET so I'm picking it up
> pretty quickly).
>
> Right now I have the following code in an activity:
>
> Gallery gal = new Gallery(ctx);
>                         gal.setLayoutParams(new 
> LayoutParams(LayoutParams.FILL_PARENT,
> LayoutParams.WRAP_CONTENT));
>                         gal.setAdapter(new HomeGalImgAdapter(ctx));
>                         gal.setHorizontalFadingEdgeEnabled(true);
>                         gal.setSpacing(0);
>                         gal.setClickable(true);
>                         gal.setFocusable(true);
> //                      gal.setUnselectedAlpha(0.5f);
>                         topPanel.addView(gal);
>
> Along with this image adapter class:
>
> public class HomeGalImgAdapter extends BaseAdapter {
>         private Context myContext;
>
>         private int[] myImageIds = {
>                         R.drawable.test128_add_to_folder,
>                         R.drawable.test128_calendar,
>                         R.drawable.test128_chart_pie,
>                         R.drawable.test128_clock,
>                         R.drawable.test128_comments
>         };
>         public HomeGalImgAdapter(Context c) { this.myContext = c; }
>         public int getCount() { return this.myImageIds.length; }
>         public Object getItem(int position) { return position; }
>         public long getItemId(int position) { return position; }
>
>         public View getView(int position, View convertView, ViewGroup parent)
> {
>                 ImageView i = new ImageView(this.myContext);
>
>                 i.setImageResource(this.myImageIds[position]);
>                 /* Image should be scaled as width/height are set. */
>                 i.setScaleType(ImageView.ScaleType.FIT_XY);
>                 /* Set the Width/Height of the ImageView. */
>                 i.setLayoutParams(new Gallery.LayoutParams(96, 96));
>                 return i;
>         }
>         }
>
> This works perfectly, and the gallery displays with a bunch of other
> content. How do I implement your suggestion to have the not-in-focus
> images be scaled smaller?
>
> Also, I am trying to figure out how to set a TextView to act as a
> caption whenever the picture changes focus, but at the moment as soon
> as I start scrolling through the gallery and the first image loses
> focus I am unable to get another image to take focus. Still trying to
> figure that one out...
>
> Thanks for your help!
>
> On Sep 2, 5:10 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Just override the method getChildStaticTransformation() in ViewGroup
> > and for the given child, set the transformation to a smaller scale.
> > Then in your constructors, make sure you set the flag
> > FLAG_SUPPORT_STATIC_TRANSFORMATIONS in mGroupFlags:
>
> > mGroupFlags |= FLAG_SUPPORT_STATIC_TRANSFORMATIONS;
>
> > On Tue, Sep 2, 2008 at 12:47 PM, Chris Cicc <[EMAIL PROTECTED]> wrote:
>
> > > Hi Romain Guy,
> > > How would I go about doing this? I'd really like to enable two pieces
> > > of functionality that were removed in the 0.9 Beta, a smaller scale
> > > for the not-in-focus images, and the ability to automatically loop
> > > (and rotate through) the gallery. Alpha on the edges would be nice,
> > > but I can live without that...
>
> > > Any chance we could get a code sample on what you suggest?
>
> > > Thanks,
> > > Chris
>
> > > On Aug 29, 7:42 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> > >> Note that you can build your own replacement by creating a subclass of
> > >> a ViewGroup and enabling support for children static transformations.
>
> > >> On Fri, Aug 29, 2008 at 3:50 PM, Megha Joshi <[EMAIL PROTECTED]> wrote:
> > >> > The getScale() API was removed from BaseAdapter, because now theGallery
> > >> > widget does not support scaling the focussed item in relation to the 
> > >> > other
> > >> > items.
> > >> > No replacement was added. It is recommended that you don't alter the
> > >> > standard behavior of theGallerywidget.
> > >> > Is there any particular reason you want to do this?
>
> > >> > 2008/8/29 blim <[EMAIL PROTECTED]>
>
> > >> >> What should we use to replace getScale from BaseAdapter, which has
> > >> >> been deHey,
>
> I appreciate the prompt reply. Unfortunately I'm having trouble making
> complete sense of your instructions. I admit I'm new to Java and
> Android (though I'm very experienced in C#.NET so I'm picking it up
> pretty quickly).
>
> Right now I have the following code in an activity:
>
> Gallery gal = new Gallery(ctx);
>                         gal.setLayoutParams(new 
> LayoutParams(LayoutParams.FILL_PARENT,
> LayoutParams.WRAP_CONTENT));
>                         gal.setAdapter(new HomeGalImgAdapter(ctx));
>                         gal.setHorizontalFadingEdgeEnabled(true);
>                         gal.setSpacing(0);
>                         gal.setClickable(true);
>                         gal.setFocusable(true);
> //                      gal.setUnselectedAlpha(0.5f);
>                         topPanel.addView(gal);
>
> Along with this image adapter class:
>
> public class HomeGalImgAdapter extends BaseAdapter {
>         private Context myContext;
>
>         private int[] myImageIds = {
>                         R.drawable.test128_add_to_folder,
>                         R.drawable.test128_calendar,
>                         R.drawable.test128_chart_pie,
>                         R.drawable.test128_clock,
>                         R.drawable.test128_comments
>         };
>         public HomeGalImgAdapter(Context c) { this.myContext = c; }
>         public int getCount() { return this.myImageIds.length; }
>         public Object getItem(int position) { return position; }
>         public long getItemId(int position) { return position; }
>
>         public View getView(int position, View convertView, ViewGroup parent)
> {
>                 ImageView i = new ImageView(this.myContext);
>
>                 i.setImageResource(this.myImageIds[position]);
>                 /* Image should be scaled as width/height are set. */
>                 i.setScaleType(ImageView.ScaleType.FIT_XY);
>                 /* Set the Width/Height of the ImageView. */
>                 i.setLayoutParams(new Gallery.LayoutParams(96, 96));
>                 return i;
>         }
>         }
>
> This works perfectly, and the gallery displays with a bunch of other
> content. How do I implement your suggestion to have the not-in-focus
> images be scaled smaller?
>
> Also, I am trying to figure out how to set a TextView to act as a
> caption whenever the picture changes focus, but at the moment as soon
> as I start scrolling through the gallery and the first image loses
> focus I am unable to get another image to take focus. Still trying to
> figure that one out...
>
> Thanks for your help!
>
> > >> --
> > >> Romain Guywww.curious-creature.org
>
> > --
> > Romain Guywww.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
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 Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to